3 ms·
> can use the quote operator to write control structures The quote operator cannot be used for writing control structures in Lisp, unless we are referring to s
by kazinator 6y ago
> can use the quote operator to write control structures
The quote operator cannot be used for writing control structures in Lisp, unless we are referring to something you generally should not do in production code, like:
(defun meta-circular-if (cond then else)
(if (eval cond) (eval then) (eval else)))
(meta-circular-if (quote (> 3 2)) (quote (+ 4 4)) 0)
Quoting is nothing like referring to Forth words as data. When Forth code refers to a Forth word foo, that's more like (function foo) than (quote foo).
- a1369209993 6y ago> The quote operator cannot be used for writing control structures in Lisp I'm not sure this is what they had in mind, but I've actually done pretty much this when bootstrapping. Eg: (def (do-if cond) # actually a built-in, but defined this way (if cond id quote)) ((do-if tee) (foo)) # (id (foo)) ((do-if nil) (bar)) # (quote (bar))