3 ms·
CL-USER 16 > (defparameter a 0) A CL-USER 17 > (if (foo) (foo) (foo)) T CL-USER 18 > a 4 CL-USER 19 > (defparameter a 0) A C
by lispm 11y ago
CL-USER 16 > (defparameter a 0)
A
CL-USER 17 > (if (foo) (foo) (foo))
T
CL-USER 18 > a
4
CL-USER 19 > (defparameter a 0)
A
CL-USER 20 > (_if (->altboolean (foo)) (foo) (foo))
T
CL-USER 21 > a
5
Given that foo is defined as:
(defmacro foo () (incf a) '(progn (incf a) t))
4 vs. 5
Does not look like a true replacement for IF in Common Lisp...
- lisper 11y ago4 and 5 are both correct results. Implementations have a lot of flexibility regarding when macro expanders are called.