baldmountain
Proposal: Pipe End operator |>>
Having worked a bit with Clojure’s threading operators → and ->> I find that sometimes I’d like a pipe end operator like Clojure’s ->> operator. What this would do is pass the piped value at the end of the parameter
list rather than the beginning. I’ve seen code that overcomes this shortcoming like this
data
|> &(do_something(var, &1)).()
Instead it would be nice if we could instead do:
data
|>> do_something(var)
Sorry if this has been suggested before.
Most Liked Responses
benwilson512
It gets suggested every 6 months or so. Unless this brings something new to those discussions I’m probably going to suggest we lock the thread so we can avoid just having the same conversation again.
benwilson512
The general answer here is to not pipe to anonymous functions at all, but create a defp named function that does the swap. This is almost always superior because names are rarely bidirectional. IE most function names don’t read as well if the order of the arguments is switched, so writing a defp gives you the opportunity to reword things properly.
CptnKirk
https://github.com/taiansu/pipe_to
Supports piping to any location.








