Hacker News new | ask | show | jobs
by matheusmoreira 994 days ago
Just like Clojure's threading operator.

  (-> x
     (f)
     (g)
     (h))
https://clojure.org/guides/threading_macros
1 comments

For those that don't know. In Clojure it is also perfectly valid to drop the parantheses for each subsequent call in a threading macro if you don't want to pass in any additional arguments:

  (-> x f g h)
If you need to pass an additional argument to g you can always do:

  (-> x f (g foo) h)
There are thread first ->, thread last ->>, and even a thread as "as->" depending on where you want to place the argument when you pipe the result through the thread of functions.