Pipe madness?

I agree that Alco’s forumulation is best, but for short phrases its idiomatic to avoid unnecessary assignment, and pipes are the best way to do that in many cases.

More readable than the nested calls is:

max(0, interval - elapsed_time) |> schedule_events()

Which, seems fine to me, but Credo will give me **** about not starting a pipe with a value so I have to write

0 |> max(interval - elapsed_time) |> schedule_events()

I don’t think that’s much better than what we started with.

3 Likes