Shorthand for (quote ...)
, '
turns code into data.
stuff
is a symbol, that means it can be a name of a variable or name of a function, etc..
'stuff
gives you the symbol "stuff" itself.
(dostuff "on" those 4 :parameters)
when evaluated, would run function dostuff
with four parameters: string, content of variable those, number and keyword.
'(dostuff "on" those 4 :parameters)
when evaluated would return the code above, which, when evaluated, would in turn run function dostuff
with that four parameters..
For example:
Run '''somecode
, it returns ''somecode
. Run ''somecode
, it returns 'somecode
. Run 'somecode
, it returns somecode
. Run somecode
, and... well... somecode
will run.
You can say that '
is a bit like the opposite of (eval..)
.
(eval (eval (eval '''(print "hello"))))
would print "Hello".
(eval (eval (eval ''''(print "hello")))
- notice one more '
then eval
- would not print anything, but it would return the code (print "hello")
itself!!
Except that lispers tend to call that returned code (and sometimes even handwritten code) "list" instead of "code", for reasons that will be bleeding obvious as you dig just a bit deeper. Good luck :)