8 ms·
In Lisp it makes a difference, because source code is data (other than text) and one can also compute source code in the REPL. For example we can write a macro
by lispm 6y ago
In Lisp it makes a difference, because source code is data (other than text) and one can also compute source code in the REPL.
For example we can write a macro in Lisp and play around with it giving it code as data and see the result as code as data.
CL-USER 1 > (defmacro while (condition &body body)
`(tagbody start
(if (not ,condition) (go end))
,@body
(go start)
end))
WHILE
CL-USER 2 > (setf a 1)
1
CL-USER 3 > '(while (< a 4) (print a) (incf a))
(WHILE (< A 4) (PRINT A) (INCF A))
CL-USER 4 > (macroexpand-1 *)
(TAGBODY START (IF (NOT (< A 4)) (GO END)) (PRINT A) (INCF A) (GO START) END)
T
CL-USER 5 > (pprint *)
(TAGBODY
START (IF (NOT (< A 4)) (GO END))
(PRINT A)
(INCF A)
(GO START)
END)
CL-USER 6 > (eval ***)
1
2
3
NIL