Expanding macros in-place can break lambdas at execution-time if the macro is passed as an argument:
(defun foldl (fn init lst) (if (null lst) init (foldl fn (fn init (car lst)) (cdr lst))))
(foldl + 0 (list 1 2 3)) ; => 6
(foldl or () (list () t)) ; => t
(foldl + 0 (list 1 2 3)) ; => 0
The second call to foldl actually expands the or inline into (fn init (car lst)) which breaks the third call (and all other subsequent ones). I found this bug in my own lisp implementation which has been heavily influenced by yours. I'm working on fixing it for myself but wanted to have a peek to see how you solved it - but you hadn't.
Expanding macros in-place can break lambdas at execution-time if the macro is passed as an argument:
The second call to
foldlactually expands theorinline into(fn init (car lst))which breaks the third call (and all other subsequent ones). I found this bug in my own lisp implementation which has been heavily influenced by yours. I'm working on fixing it for myself but wanted to have a peek to see how you solved it - but you hadn't.