Thanks for the (positive) feedback.

My problem is: if you think this through, lots of things could change. 

Consider that I added #magnitudes this would imply that sorting should move 
too, because you cannot assume the objects to be sortable (i.e. Magnitudes or 
conforming to that protocol).

Also, this would create a kind of parallel hierarchy, with more type 
information. It feels like a simple single inheritance hierarchy cannot cover 
all combinations (for example, being sequenceable and being numbers, as opposed 
to being just a collection of numbers).

Sorting an unordered collection is also different from sorting an ordered one 
(this last one could keep its type, or even be sorted in place).

So maybe this is a can of worms. I am all for dynamic typing, not for trying to 
add some (weak) for of static typing.

> On 07 Jan 2016, at 13:14, Max Leske <[email protected]> wrote:
> 
> Very, very cool Sven (and Henrik!)!
> 
> And it even works with exotic objects: { 1@2. 2@3 } numbers sum “—> (3@5)”
> 
> Could Collections-Arithmetic be integrated into the collections operations? 
> Not really sure that’s a good idea, I just want to know.
> 
> Cheers,
> Max
> 
>> On 04 Jan 2016, at 16:19, Tudor Girba <[email protected]> wrote:
>> 
>> Thank you, Sven!
>> 
>> I like this very much.
>> 
>> This would also mean that we could deprecate Collection>>#sum altogether :))
>> 
>> Cheers,
>> Doru
>> 
>> 
>>> On Dec 30, 2015, at 12:53 AM, Sven Van Caekenberghe <[email protected]> wrote:
>>> 
>>> Hi Henrik,
>>> 
>>>> On 25 Dec 2015, at 14:08, Henrik Nergaard <[email protected]> wrote:
>>>> 
>>>> Like this?
>>>> http://smalltalkhub.com/#!/~Latsabben/NumIt
>>> 
>>> That is a cool take on a possible approach. Thanks for doing it, it makes 
>>> it much easier to think about and discuss alternatives.
>>> 
>>> This inspired me to do something similar, but not quite. I am just thinking 
>>> out loud by implementation. Here is my result:
>>> 
>>> <Collections-Operations-SvenVanCaekenberghe.1.mcz>
>>> 
>>> There are some examples in the class comments.
>>> 
>>> Sven
>>> 
>>>> Best regards,
>>>> Henrik
>>>> 
>>>> -----Original Message-----
>>>> From: Pharo-dev [mailto:[email protected]] On Behalf Of 
>>>> stepharo
>>>> Sent: Thursday, December 24, 2015 9:58 AM
>>>> To: Pharo Development List <[email protected]>
>>>> Subject: Re: [Pharo-dev] #sum:, #detectSum:, #sumNumbers:
>>>> 
>>>> Just a remark.
>>>> I think that we discarded the proposition of having
>>>> 
>>>> aCol arithmetic sum
>>>> 
>>>> but I found it nice because there if was clear that you want to get back 
>>>> 0 for #().
>>>> 
>>>> Stef
>>>> 
>>> 
>> 
>> --
>> www.tudorgirba.com
>> www.feenk.com
>> 
>> "Innovation comes in the least expected form. 
>> That is, if it is expected, it already happened."
>> 
>> 
> 
> 


Reply via email to