Skip to content

Instantly share code, notes, and snippets.

@kurogelee
Created March 31, 2014 18:17
Show Gist options
  • Save kurogelee/9898706 to your computer and use it in GitHub Desktop.
Save kurogelee/9898706 to your computer and use it in GitHub Desktop.
Clojureでmapcatのfor版としてforcatを作る(+おまけpapply) ref: http://qiita.com/kurogelee/items/c992d8fe15a21bdb5793
user=> (forcat [x (range 3) y [:a :b]] [x] [y])
(0 :a 0 :b 1 :a 1 :b 2 :a 2 :b)
(defmacro forcat [seq-exprs & body-exprs]
`(apply concat (for ~seq-exprs (concat ~@body-exprs))))
(defn papply [f & args] (apply partial apply f args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment