4 ms·
Clojure has a threading macro built in (http://clojuredocs.org/clojure.core/-%3E http://clojuredocs.org/clojure.core/-%3E) which lets you write code like :
by weavie 11y ago
Clojure has a threading macro built in (http://clojuredocs.org/clojure.core/-%3E http://clojuredocs.org/clojure.core/-%3E) which lets you write code like :
user=> (-> "a b c d"
.toUpperCase
(.replace "A" "X")
(.split " ")
first)
It is trivial to write the macro in other Lisps.
- sgrove 11y agoThis is one of the nicest macros - chaining with sane return semantics and no overhead/boxing required. Breaks my heart trying to replicate it.