Skip to content

Instantly share code, notes, and snippets.

@vasily-kirichenko
Created November 6, 2012 17:09
Show Gist options
  • Save vasily-kirichenko/4026073 to your computer and use it in GitHub Desktop.
Save vasily-kirichenko/4026073 to your computer and use it in GitHub Desktop.
Thread-it
(defmacro >> [& [first-expr & rest-exprs]]
(if (empty? rest-exprs)
first-expr
`(let [~'it ~first-expr]
(thread-it ~@rest-exprs))))
(>>
[jay john mike chris]
(filter (comp (partial = "new york") :current-city) it)
(group-by :employer it)
(update-in it ["drw.com"] (partial map :name)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment