You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 syntax itr |> Filter(f) |> Map(g) which is equivalent to eduction(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 apply sin to them" but I'm sure at least some people would protest that this is a horrible pun that does not respect the semantics of Base.:(&). I kinda like this.
Another available ascii operator is -->, so we could have Filter(iseven) --> Map(sin) read as "filter out even numbers and then apply sin to them". I'm not a huge fan of this, but it does have the advantage of being an available unicode operator.
The text was updated successfully, but these errors were encountered:
Originally you used to be able to write
foldl(+, Filter(f) |> Map(g), itr)
but this was deprecated and replaced withfoldl(+ Filter(f) ⨟ Map(g), itr)
wheref ⨟ g
meansg ∘ f
(also known asopcompose
). 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:
|>
. 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)
.&
(i.e.Filter(iseven) & Map(sin)
would read as "filter out even numbers and applysin
to 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.-->
, so we could haveFilter(iseven) --> Map(sin)
read as "filter out even numbers and then applysin
to them". I'm not a huge fan of this, but it does have the advantage of being an available unicode operator.The text was updated successfully, but these errors were encountered: