2 ms·
Interesting, coming from Clojure/Script it bothers me that you need to repeat the pipe since I'm used to: (-> "a b c d" s/upper-case (s/r
by didibus 5y ago
Interesting, coming from Clojure/Script it bothers me that you need to repeat the pipe since I'm used to:
(-> "a b c d"
s/upper-case
(s/replace "A" "X")
(s/split " ")
first)
But I guess in JS you wouldn't know when to stop the piping.
Also, in Clojure, you have -<> which is like a hybrid between Hack and F# pipes. Basically it defaults to piping into the first argument, but if you use <> anywhere, then where you've used it is where it will be piped instead, best of both worlds.
(-<> "a b c"
s/upper-case
(str "result:" <>))
- fulafel 5y ago-<> is from a 3rd party library I guess? The joys of macros and extensible syntax :) The standard library has as-> , which doesn't have the implcit default. So you'd write (as-> "a b c" x (s/upper-case x) (str "result:" x))