2 ms·
Hold up. X in the above is a symbol. Symbols may be bound to a function or they may not. But x here is always a symbol. When you write (x) in the Lisp REPL, Li
by dreamcompiler 7y ago
Hold up. X in the above is a symbol. Symbols may be bound to a function or they may not. But x here is always a symbol.
When you write (x) in the Lisp REPL, Lisp will assume you intend to call a function bound to x because x appears first in the list. If you instead wrote (y x), Lisp would never assume x was a function. If the first thing in a list is not bound to a function, Lisp will throw an error.
When you write '(x) [note leading quotation mark], Lisp will simply construct a list that contains the symbol x as its only element.
In my explanation above, I didn't make the distinction about the quotation mark because I assumed the questioner was asking about data structures. Lisp will print "the list containing x" without the quotation mark. But if that's what you mean when you type it, you have to explicitly type the quotation mark.
- nickloewen 7y agoYes, this is a good clarification!