You also have the pretty compact option:

’’’
map = (foo && Map.put(map, :foo, foo)) || map
’’’

You could make it pipeable by wrapping it in an anonymous function:


’’’
map
|> &((foo && Map.put(&1, :foo, foo)) || &1).()
’’’

-- 
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/884e3aea-0fd5-462f-ac71-d8e3695401eco%40googlegroups.com.

Reply via email to