Hugo Hörnquist 16 Jun 2022
Lästid: 1 minut(er)Lisps Quasiquotation
A while ago I noted that macros are the tool for handling code. I have since then realized just how powerful they are when left to their own devices. Previously I believed that quasiquotation would be hard to implement, having to seek the whole tree for unquotes, but the macro is simply
(define-syntax quasiquote
(syntax-rules (unquote unquote-splicing)
((_ ,form) form)
((_ (,@forms rest ...)) (append forms `(rest ...)))
((_ (lit lits ...)) (cons `lit `(lits ...)))
((_ a) 'a)))
RSS-feed to see more like this.