[Cuis-dev] Bag>>#sum:ifEmpty:

Hernán Wilkinson hernan.wilkinson at 10pines.com
Wed Nov 2 13:12:34 PDT 2022


How does that optimization work?
Because I thought about evaluating the block and multiplying that for the
number of elements, but that makes sense if the block returns always the
same value por the same element, if it does not then it will not work...


On Wed, Nov 2, 2022 at 3:24 PM Juan Vuletich <juan at cuis.st> wrote:

> On 11/1/2022 11:23 PM, Hernán Wilkinson via Cuis-dev wrote:
>
> yeap, the current implementation is not correct.
> Juan, attached is a change set that fixes it and another with the related
> tests.
>
> Cheers!
> Hernan.
>
> On Tue, Nov 1, 2022 at 3:39 AM Luciano Notarfrancesco <luchiano at gmail.com>
> wrote:
>
>> I’m afk right now so I cannot check, but it sounds like I made a mistake.
>> Of course it should be the value of aBlock at each element times the number
>> of occurrences.
>>
>> On Tue, 1 Nov 2022 at 07:33 Hernán Wilkinson <
>> hernan.wilkinson at 10pines.com> wrote:
>>
>>> Hi,
>>>  the implementation of Bag>>#sum: aBlock ifEmpty: emptyBlock does not
>>> use the parameter aBlock at all and assumes that each of the elements
>>> answers the message *
>>>  @Luciano Notarfrancesco <luchiano at gmail.com> the implementation is
>>> yours and it is very new? Is there a reason you did that way?
>>>
>>> Thanks
>>> Hernan
>>>
>>>
>>> --
>>>
>>> *Hernán Wilkinson Agile Software Development, Teaching & Coaching*
>>> *Phone: +54-011*-4893-2057
>>> *Twitter: @HernanWilkinson*
>>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>>> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>>>
>>
>
> --
>
> *Hernán Wilkinson Agile Software Development, Teaching & Coaching*
> *Phone: +54-011*-4893-2057
> *Twitter: @HernanWilkinson*
> *site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>
>
> Hi Hernán,
>
> Your fix disables the optimization Luciano did. I chose to fix Luciano's
> code. Did the same for #product: (same bug). Integrated your tests, and
> added another one for #product:
>
> Thanks,
>
> --
> Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
>
>

-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20221102/9b81c321/attachment.htm>


More information about the Cuis-dev mailing list