A pattern I find myself in all the time is when I am writing a piped series of function calls, when I need to pass the result into some parameter other than the first one.
Something like this.
Map.get( p_map, puid )
|> Group.insert_at( index, uid )
|> ( &Map.put(p_map, puid, &1) ).()
|> ( &put_primitive_map(graph, &1) ).()
|> something_else()
The trick to pipe into a anonymous function works, but is ugly and least to poor readability.
I would really like a pipe_right macro, which would work something like this.
Map.get( p_map, puid )
|> Group.insert_at( index, uid )
|>> Map.put(p_map, puid, &1)
|>> put_primitive_map(graph, &1)
|> something_else()
Note that it should be interchangeable with the standard pipe without breaking the piping flow.
I keep running into this and reached the point where I really want this macro in the Kernel module.