3 ms·
Two solutions. Threading macros wherein instead of nested parens like (x (y (z))) one writes ((->> z) y x) In clojure there is an inte
by michaelmrose 8y ago
Two solutions. Threading macros wherein instead of nested parens like (x (y (z))) one writes
((->> z)
y
x)
In clojure there is an interesting package https://github.com/rplevy/swiss-arrows https://github.com/rplevy/swiss-arrows which allows one to perform successive operations with explicit placement of the result of prior evaluation by placing a <> in the form
((->> (z <>))
(y <> 7)
(x <>))
In practice it seems like there is often less need to do so as many similar functions or the same variety have the same ordering and other options like as-> exist too.
There is also the idea of processing math expressions infix as expected when desired.
https://github.com/rm-hull/infix https://github.com/rm-hull/infix
($= 3 + 5 * 8)
; => 43