Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: format-with-slots , Previous: flatten , Up: F , Home: Overview

Clamps Dictionary

flatten-fn

Function

(flatten-fn list &key (test #'atom) (key #'identity))

Remove all brackets except the outmost in list. Use test and key to determine where to stop removing brackets.

Arguments

list input List.
test Function applied to each element of list to test for the end of flattening.
key Function applied to each element of list before testing.

Examples

(flatten-fn '((a b) (((c d) (e f)) (g h)) (i k)))
;; -> (a b c d e f g h i k)

;; keep one level of brackets:

(flatten-fn '((a b) (((c d) (e f)) (g h)) (i k)) :key #'car)
;; -> ((a b) (c d) (e f) (g h) (i k))

See also

Author: Orm Finnendahl

Created: 2025-02-18 Di 12:58

Validate