9 The quote form
A quote form can also be written by putting a single-quote (apostrophe) before an expression. 'datum is equivalent to (quote datum).
Quoting a name creates a symbol. Quoting a piece of literal data like a number, boolean, or string produces that same number, boolean, or string.
> 'antithesis 'antithesis
> '42 42
> 'nil nil
> '"literal literal" "literal literal"
It gets more complicitated when you use it with parentheses. It creates a list, but it also "distributes itself" over everything within it, including to every element of the list. So (quote (datum ...)) is equivalent to (list (quote datum) ...).
> '(this is not a pipe) (list 'this 'is 'not 'a 'pipe)
> '(this is not a five: (+ 2 3)) (list 'this 'is 'not 'a 'five: (list '+ 2 3))
> '(((distributes) ((((((((arbitrarily)))) far))))))
(list
(list
(list 'distributes)
(list (list (list (list (list (list (list (list 'arbitrarily)))) 'far))))))
> (defunc my-function (a) :input-contract t :output-contract t 42) > '(functions are not evaluated: (my-function 5)) (list 'functions 'are 'not 'evaluated: (list 'my-function 5))
> '(not even quote is evaluated: '5) (list 'not 'even 'quote 'is 'evaluated: (list 'quote 5))
; keep in mind '5 is another way of writing (quote 5) > ''5 (list 'quote 5)
> '('5) (list (list 'quote 5))