Hi, Am 25.11.2009 um 22:43 schrieb David Brown:
(defmacro lazy-seq "..." [& body](list 'new 'clojure.lang.LazySeq (list* '#^{:once true} fn* [] body)))That's it. The neat thing is that you or I can also write macros that do this kind of thing. It's one of the things that makes Lisp so powerful.
But please don't write them in this style. This is done only, because syntax-quote is not yet fully available at the point in core.clj. A good style macro would like this:
(defmacro lazy-seq "..." [& body] `(LazySeq. ~(with-meta `fn* {:once true}) [] ~...@body)) (Assuming LazySeq was :imported...) Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature