Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
But it doesn’t always work like I’d expect. For example, I tried to create a list of functions, like this, but it didn’t work:
A rule of thumb: use list whenever you want the arguments to be evaluated; quote “distributes” over its arguments, so '(+ 1 2) is like (list '+ '1 '2). You’ll end up with a symbol in your list, not a function.
In Scheme and Racket, quote and list are entirely different things, but since both of them can be used to produce lists, confusion is common and understandable. There is an incredibly important difference between them: list is a plain old function, while quote (even without the special ' syntax) is a special form. That is, list can be implemented in plain Scheme, but quote cannot be.
The list function is actually by far the simpler of the two, so let’s start there. It is a function that takes any number of arguments, and it collects the arguments into a list.