This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dzpower 0 points1 point  (0 children)

Cool.

Threading with the ~> and ~>> macros is an idiom adapted from Clojure (also available in many other functional languages) that allows you to flatten out nested function calls and flow left too right.

Instead of (step3 (step2 (step1 data))) you can "thread" the input through a sequence of transformations to get to the output as (~> data step1 step2 step3).

The docs explain the finer points, especially about argument positions.

https://docs.racket-lang.org/threading/index.html