|
|
|
|
|
by temp00345
1931 days ago
|
|
There's a simple rule I use: -> is for maps and ->> is for collections. Functions that take a map should take it as first argument, functions that take collections should take the collection as last argument.
This is how the clojure core functions work, eg. -> `assoc`, `conj`, `dissoc` vs ->> `map`, `filter`, `reduce`, `some`. If you follow this rule in your code, threading is nice and looks good.
If you want to force different argument position, use a lambda, like so
(->> coll (#(my-fn %))). However, I recommend against it. Use a binding and then use the other threading macro if necessary. |
|