Additionally, for the specific example you mentioned, where you seem to be 
getting something out of a map, updating it, and putting it back in, there 
is `Map.update!/3` (https://hexdocs.pm/elixir/Map.html#update!/3)
 and `Map.update/4`.

On Friday, 9 March 2018 19:49:09 UTC, Ben Wilson wrote:
>
> I would highly recommend taking a walk through existing threads in the 
> mailing list and forums. This and other similar pipe additions have been 
> requested before. I'm glad you're interested in improving the language, but 
> the proposal itself doesn't reflect a familiarity with existing answers to 
> this very question.
>
> On Friday, March 9, 2018 at 2:45:24 PM UTC-5, Boyd Multerer wrote:
>>
>> 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.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/69f35d02-33f8-4427-ba27-eeeb931b46b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to