You can already capture the `if` and do it as a one-liner x |> then(&if(pred(&1), do: f(&1), else: &1))
so you don't gain much yet add more complexity. Additionally, your suggestion only implies what happens if `pred` is falsy while mine is clear. -Greg Vaughn > On Aug 3, 2024, at 4:16 PM, Caio Oliveira <caio...@gmail.com> wrote: > > x > |> then(fn val -> > if pred(&1) do > f(val) > else > val > end) > > Into this: > > x |> then(&f/1, if: &pred/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 elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/1ED9C904-C87D-436B-AC16-A653B62B3E90%40gmail.com.