‹ BackHN Continuity

Thread

Ten lines of code that changed my world

148 points · 46 comments · dimonomid

  1. andsoitis · · focus · 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"))
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.