Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created December 11, 2009 10:58
Show Gist options
  • Save mneedham/254136 to your computer and use it in GitHub Desktop.
Save mneedham/254136 to your computer and use it in GitHub Desktop.
(defn say-hello [person] println "hello" person)
(say-hello "Mark")
-> "Mark"
If I put the brackets in then it'll work fine:
(defn say-hello [person] (println "hello" person))
(say-hello "Mark")
-> hello mark
nil
So that means 'println' was evaluated with the two arguments...
So what happens in the first case where I don't include the brackets? It just output the values?
In which case...
(defmacro say-hello [person]
'println "Hello" person)
Why does this expand like so?
(macroexpand-1 '(say-hello blah))
-> blah
Is that because it evaluated println and "Hello" at expand time and then 'blah'
was the only thing it didn't know what to do with?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment