Skip to content
Macros for working with clojure argument threading
Clojure Shell
Failed to load latest commit information.
src/pallet Add indentation metadata to macros Apr 6, 2012
test/pallet makes 1.3 compatible while maintaining 1.2 backwards compatibility Jan 27, 2012
.gitignore Updated project.clj, release notes and readme for 1.3.0 Mar 13, 2013
epl-v10.html Added license Apr 20, 2011
profiles.clj Use lein as the build tool and deploy to clojars Mar 13, 2013
project.clj Updated version for next release cycle Mar 13, 2013 Use lein as the build tool and deploy to clojars Mar 13, 2013


A library containing macros for use in clojure threading expressions (using ->).

See reference documentation and annotated source.


Threaded arg exposure:

arg-> exposes the threaded arg, binding it to the supplied variable. For example:

(-> 2
   (arg-> [x]
     (* (inc x))))

;=> 6

Expands to:

(-> 2 
   ((fn [arg] (let [x arg] (-> arg (* inc x))))))

;=> 6

Note the extra set of parens in the expansion; the threading macro feeds the current argument in as arg, binds it to the supplied var using let, and resumes threading for all forms inside of arg->.

Threaded list comprehension:

The following use of for->:

(-> 1
   (for-> [x [1 2 3]]
     (+ x)))

;=> 7

Expands to:

(-> 1
   (+ 1)
   (+ 2)
   (+ 3))

;=> 7


thread-expr is distributed as a jar, and is available in the clojars repository.

Installation is with leiningen or your favourite maven repository aware build tool.

lein/cake project.clj

:dependencies [[com.palletops/thread-expr "1.3.0"]]

maven pom.xml




Licensed under EPL

Copyright 2011, 2012, 2013 Hugo Duncan.

Something went wrong with that request. Please try again.