chickadee » ck-macros » c-compose

(c-compose '((OP-N ...) ... (OP-1 ...)) X ...) → resultsyntax

Compose one or more CK-macros and apply them to the arguments. Calls the right-most OP with the arguments X ..., then calls the next-right-most OP with that result, and so on:

(OP-N ... (OP-2 ... (OP-1 ... X ...)))

OP-1 must accept all the Xs as arguments, and the other OPs must each accept one argument (the result of the previous operation). See also c-rcompose, which is more efficient. Added in version 0.2.0

(ck () (c-compose '((c-car) (c-cdr)) '(1 2 3)))
;; ==> 2

;;; Map over a list of lists to see which are not empty.
(ck () (c-quote (c-map1 '(c-compose '((c-not) (c-null?)))
                        '((1) () (2 3)))))
;; ==> '(#t #f #t)