No opinion on whether this function exists or not. But, if it did, I think
the second argument should be a function, so that conditionality can depend
on a property of the first argument.

Allen Madsen
http://www.allenmadsen.com


On Fri, Oct 8, 2021 at 6:59 AM 'Damir' via elixir-lang-core <
elixir-lang-core@googlegroups.com> wrote:

> Often I have a function that I want to apply to a pipeline conditionally.
> I'm forced not to either write a "maybe_do_x" function or use an inline
> check with then/2.
>
> Now that we have then/2, I'm thinking it might be nice to have then/3 so
> that we don't need "maybe_" functions anymore, improving composability.
> Example usage:
>
> y_needed = # true or false
>
> some_value
> |> do_something()
> |> then(y_needed, &write_y(&1, arg0, arg1) )
>
> --
> 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 elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/9b4501b4-e114-4421-b61a-74240d160a15n%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/9b4501b4-e114-4421-b61a-74240d160a15n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3CuZQ7JBAWyjzihVF8iyOMZfkEsc%2Bu16CmVHFyhKPQV6oQ%40mail.gmail.com.

Reply via email to