-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Originally you used to be able to write foldl(+, Filter(f) |> Map(g), itr) but this was deprecated and replaced with foldl(+ Filter(f) ⨟ Map(g), itr) where f ⨟ g means g ∘ f (also known as opcompose). This was changed for somewhat convincing ideological reasons, but it's also quite the usability pain. (ref JuliaFolds/Transducers.jl#67).
I am very tempted to re-enable the Map(f) |> Filter(g) pattern for composing transducers, or at the very least, find a suitable ascii replacement for ⨟.
Some ascii options I'm thinking of:
- Bite the bullet and just do
|>. This is quite nice especially because its familiar and does match the eduction syntaxitr |> Filter(f) |> Map(g)which is equivalent toeduction(Filter(f) ⨟ Map(g), itr). - Maybe another ascii option would be
&(i.e.Filter(iseven) & Map(sin)would read as "filter out even numbers and applysinto them" but I'm sure at least some people would protest that this is a horrible pun that does not respect the semantics ofBase.:(&). I kinda like this. - Another available ascii operator is
-->, so we could haveFilter(iseven) --> Map(sin)read as "filter out even numbers and then applysinto them". I'm not a huge fan of this, but it does have the advantage of being an available unicode operator.
Reactions are currently unavailable