Created
December 11, 2009 10:58
-
-
Save mneedham/254136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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