Repost from:
http://yangweilim.com/blog/2015/11/18/clojure-thread-first-vs-thread-last-macros/
In this post, I am going to show you {when|how} to use Clojure marcos, ->>
aka thread-last and ->
aka thread-first. In some case, ->
and ->>
may perform the same operation if you do not pay enough attention. So I will also show you what's the difference between them. Note that doc ->
and docs ->>
din't make sense for me at first, so if same thing happened to you I hope that this post will make it clear.
If I am coding a function in Clojure, I would not think to write in macro firstly(maybe I am still new to it?). Macros like ->
and ->>
only come in my mind when it comes to refactoring. They are not neccessary in our program but they will make it elegant.
To explain how both of these macros work, let's us solve a quiz together.
[Write a function which calculates factorials.](http://www.4clojure.com/prob