2 ms·
Clojure has -> specifically to facilitate writing pipeline code that doesn't read backwards.
by nathell 12y ago
Clojure has -> specifically to facilitate writing pipeline code that doesn't read backwards.
- tgkokk 12y agoOr, in this case, ->>: (def lols (->> strs (filter #(re-find #"LOL" %)) (map upper-case) sort)) How I read it: take strs, filter the strings that contain "LOL", turn them into upper case and then sort them. Basically it reads the same as the pipeline example in the README.
- roryokane 12y agoRight – though for this example, `->>` (http://grimoire.arrdem.com/1.6.0/clojure.core/DASH__GT__GT/ http://grimoire.arrdem.com/1.6.0/clojure.core/DASH__GT__GT/) works better than `->`. I created a GitHub issue to tell the creator about it: https://github.com/xiaq/elvish/issues/17 https://github.com/xiaq/elvish/issues/17.
- xiaq 12y ago(Also see my reply to thinkpad20.) I'm not sure about Haskell, but Clojure's -> is still a serial construct (functions invoked one after another), but pipeline is parallel.