[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-20 Thread Richard O'Keefe
I've always called the block in #inject:into: the *combining* function. Perhaps the reason I don't think of it as a "reducing" function is that setOfSets inject: Set new into: [:acc :each | acc union: each] has a block that combines its arguments in a way that makes the result bigger, not smaller.

[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-17 Thread Steffen Märcker
Dear Richard, sorry for the delayed reply and thanks for your thoughts. I wrapped my head around your suggestions and tried a few thing to see how the play out in code. I tend towards the following names. - Reducing function (a role) is a binary block / object that responds to #value:value:

[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-15 Thread Richard O'Keefe
Let initial :: a combine :: a -> b -> a finish :: a -> c then (finish . foldl combine initial) :: Foldable t => t b -> c This appears to be analogous to your 'reduce with completion'. What *can* be done with composition generally *should* be done with composition; I really don't see any a

[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-14 Thread Steffen Märcker
Hi Richard! Thanks for sharing your thoughts. There's a reason why #inject:into: puts the block argument last. It works better to have "heavy" constituents on the right in an English sentence, and it's easier to indent blocks when they come last. Nice, I never though of it this way.

[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-14 Thread Richard O'Keefe
#reduce: aReduction Are you saying that aReduction is an object from which a dyadic block and an initial value can be derived? That's going to confuse the heck out of Dolphin and Pharo users (like me, for example). And in my copy of Pharo, #reduce: calls #reduceLeft:, not #foldLeft:

[Pharo-users] Re: Collection>>reduce name clash with transducers

2023-04-13 Thread Steffen Märcker
The reason I came up with the naming question in the first place is that I (finally !) finish my port of Transducers to Pharo. But currently, I am running into a name clash. Maybe you have some good ideas how to resolve the following situation in a pleasant way. - #fold: exists in Pharo and is