3 ms·
The advantage of a macro is that one doesn't have to wrap one's own code in a closure. It's cleaner to write `(try-n-times (let ((foo (bar 1))) (baz foo 2)) 3)
by wtbob 12y ago
The advantage of a macro is that one doesn't have to wrap one's own code in a closure. It's cleaner to write `(try-n-times (let ((foo (bar 1))) (baz foo 2)) 3)` than `(try-n-times (lambda () (let ((foo (bar 1))) (baz foo 2))) 3)`.
Also: man, writing Lisp without paren-matching bites.
- GregBuchholz 12y ago...but then you've just pushed the lambda somewhere else: (map (lambda (x) (try-3 x)) collection-of-try-threeables) ...that's why a lightweight anonymous function notation is useful (Clojure's #() reader macro, etc.).
- wtbob 12y agoUmmm, `(map (lambda (x) (try-3 x)) …` could just be written as `(map #'try-3 …)`