Hacker News new | past | comments | ask | show | jobs | submit login

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 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

    ($= 3 + 5 * 8)
    ; => 43



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: