This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Experiment with 'foo' blocks as an alternative to -> and ->>. | |
(defmacro foo | |
([] '%) | |
([form & more] | |
`(let [~'% ~form] (foo ~@more))) ) | |
(def foo-ex1 | |
(foo | |
1 | |
(+ 1 %) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro lazy | |
"Returns a lazy sequence of calls to (f). Arguments are evaluated once as needed. | |
(lazy f a b c d) --> (a, (f a b), (f (f a b) c), (f (f (f a b) c) d))" | |
([f x] | |
`(lazy-seq | |
(list ~x)) ) | |
([f x form & more] | |
`(lazy-seq | |
(let [x# ~x] | |
(cons x# |
NewerOlder