UP | HOME

Compare different operator in lisp

is syntactic sugar for quote, which takes a single expression as its “argument” and simply returns it, un-evaluated.

(quote (+ 1 2))  === '(+ 1 2)

is syntactic sugar for FUNCTION.

(function foo)  ===  #'foo

a backquoted expression is similar to a quoted expression except you can “unquote” particular subexpressions by preceding them with a comma, possibly followed by an at (@) sign. Basically it’s similar with quote ', but can do more, like evaluate sub-expressions by a comma. Without an at sign, the comma causes the value of the sub-expression to be included as is. With an at sign, the value–which must be a list–is “spliced” into the enclosing list.

Backquote Syntax Equivalent List-Building Code Result
`(a (+ 1 2) c)         (list ’a’(+ 1 2) ’c)                    (a (+ 1 2) c)
`(a ,(+ 1 2) c)         (list ’a (+ 1 2) ’c)                    (a 3 c)
`(a (list 1 2) c)    (list ’a’(list 1 2) ’c)                 (a (list 1 2) c)
`(a ,(list 1 2) c)    (list ’a (list 1 2) ’c)                     (a (1 2) c)
`(a ,@(list 1 2) c)    (append (list ’a) (list 1 2) (list ’c))     (a 1 2 c)