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
;sample use idea: | |
(defn mapx | |
"Returns a lazy sequence consisting of the result of applying f to the | |
set of first items of each coll, followed by applying f to the set | |
of second items in each coll, until any one of the colls is | |
exhausted. Any remaining items in other colls are ignored. Function | |
f should accept number-of-colls arguments." | |
[f coll] | |
(gen-iter iter [f seq-cell] |
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 gen-iter-fn | |
[name [op coll] has-item-body item-body move!-body] | |
`(defn ~name [~op ~coll] | |
(letfn | |
[(iter# [~op ~coll] | |
(reify :as ~'this | |
~'Iter | |
(~'has-item [] ~@has-item-body) | |
(~'item [] ~@item-body) | |
(~'move! [] ~@move!-body) |