Skip to content

Instantly share code, notes, and snippets.

@sordina
Created May 23, 2014 06:54
Show Gist options
  • Save sordina/4d441485f4276aba281d to your computer and use it in GitHub Desktop.
Save sordina/4d441485f4276aba281d to your computer and use it in GitHub Desktop.
(defmacro single-call [[x y & z]]
`(~x ~y ~@z))
(defmacro multi-call [ & xs]
`(do ~@(for [x xs] `(single-call ~x))))
(prn (macroexpand-1 `(single-call (+ 1 2 3 4))))
(prn (macroexpand-1 `(multi-call (+ 1 2 3 4) (+ 4 5 6 7))))
(prn (single-call (+ 1 2 3 4)))
(prn (single-call (+ 4 5 6 7)))
(prn (multi-call (+ 1 2 3 4) (+ 4 5 6 7)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment