logoalt Hacker News

andsoitis • today at 5:09 PM • 0 replies • view on HN

Here are 3 lines that capture something profound about Lisp: code can manufacture code that manufactures code:

———————

(defmacro twice (form)

  `(progn ,form ,form))
(twice (print "Reality"))

———————

twice doesn’t execute its argument twice. It rewrites the program itself before execution into:

(progn

    (print "Reality") 

    (print "Reality"))