chickadee » ck-macros » c-if*

(c-if* TEST 'PASS 'FAIL) → PASS or FAILsyntax

Similar to c-if, except that the branches must have an extra level of quoting, and only one branch will be expanded. This is more similar to how if behaves, but it is a bit awkward to use.

Analogous to (lambda (test pass fail) (if test (eval pass) (eval fail)))

(ck () (c-quote (c-if* (c-pair? '(x))
                       '(c-car '(x))
                       ''not-pair)))
;; ==> 'x

(ck () (c-quote (c-if* (c-pair? 'x)
                       '(c-car 'x)
                       ''not-pair)))
;; ==> 'not-pair