
My mind was blown by the pipe operator in Elixir. I felt like it completely solved the annoying problem of these deeply nested function calls I was always running into in lisp languages

But then I discovered Racket’s threading macros which are the same but way more powerful

:heart:

threading macro is generally more powerful, but one thing I really like about the pipe operator is that you can add stuff as an afterthought by simply appending text

for threading macro, you need to wrap parentheses around the expression

Hmm that is true, although it’s still much better than deeply nested functional calls anyday!

So, I’ve used the pipe operator before with both F# and OCaml, but it wasn’t until I spent a lot of time with Elixir that I grew to appreciate it.
From an Object-Oriented perspective, it serves as a bit of a missing link between methods and other functions through UFCS (uniform function call syntax). I’ve used extension methods in Kotlin before for similar things, and I think that’s a much worse alternative by modifying a namespace that doesn’t belong to you. Pipelining can serve as a neat way to break that up while keeping the style of OO method calls without compromising the namespace of the object.