apply_if/3 ?
On December 6, 2024, Ben Wilson wrote:
Exploring what that looks concretely in this case:
```
map
|> other_stuff
|> then_if(opts[:foo], &Map.put(&1, :key, value))
```
I like it! Conditional map insert helper functions are definitely something
we've written over and over again in
Hi José!
Thanks for getting back to me so quickly!
I understand that adding all `*_if` functions wouldn't be so nice on the
API.
Regarding `then_if`, I think it solves the problem and can be applied to
other situations, so I feel it's a better enhancement!
Would you be interested in adding it
A `Kernel.when/3` (or whatever name) would be something interesting,
significantly if I can add multiple captures (condition and body)
|> when(&condition(&1), &Map.put(&1, :something, value))
On Saturday, December 7, 2024 at 10:10:16 AM UTC-5 ju...@mimiquate.com
wrote:
> I like where this