Skip to content

Instantly share code, notes, and snippets.

@salvianoo
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save salvianoo/9380272 to your computer and use it in GitHub Desktop.

Select an option

Save salvianoo/9380272 to your computer and use it in GitHub Desktop.
Macro newbie
; Want to do this
=> (%w a b c d e f)
("a" "b" "c" "d" "e" "f")
; So I wrote a function
(defn %w [& collection]
(map str collection))
=> (%w 1 2 3 4 5)
("1" "2" "3" "4" "5")
; But works only with numbers
=> (%w a b c d)
; CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:1:1)
; Then I tried to write a macro but without success
(defmacro %w [& collection]
(list 'map 'str collection))
; What to do??
@salvianoo
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment