baldmountain

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

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

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

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

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

CptnKirk

https://github.com/taiansu/pipe_to

Supports piping to any location.

Last Post!

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Where Next?

Popular in Discussions Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31771 143
New
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement