-
Notifications
You must be signed in to change notification settings - Fork 2
TurtleKitty edited this page May 11, 2019
·
2 revisions
The quasiquote operator behaves like quote, but allows for the insertion of values. It allows the construction of templates for s-expressions. Items within a qq are quoted unless unquoted with unq or unqs (unquote-splicing). unq splices a value into a list unchanged; unqs splices in the values of a list.
(def x "In Our Angelhood")
(def y '(foo bar baz))
(qq (x y (unq x) (unq y) (unqs y)))
; (x y "In Our Angelhood" (foo bar baz) foo bar baz)The percent (%), dollar ($), and at-sign (@) are syntactic sugar for qq, unq,and unqs, respectively. The template above can be written more tersely:
%(x y $x $y @y)
; (x y "In Our Angelhood" (foo bar baz) foo bar baz)