fold: ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

fold: ?

Stéphane Ducasse
hi lukas

I thought that we introduced the equivalent when we were pair programming at my place.
fold: got introduced in squeak and may be your implementation/API should be pushed there?
Stef

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Lukas Renggli
See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
it never got merged though.

Lukas

On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:

> hi lukas
>
> I thought that we introduced the equivalent when we were pair programming at my place.
> fold: got introduced in squeak and may be your implementation/API should be pushed there?
> Stef
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Lukas Renggli
Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.

Lukas

On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:

> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
> it never got merged though.
>
> Lukas
>
> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
>> hi lukas
>>
>> I thought that we introduced the equivalent when we were pair programming at my place.
>> fold: got introduced in squeak and may be your implementation/API should be pushed there?
>> Stef
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Lukas Renggli
Now I remember: We called it #reduce: because this is much more common
among programming languages.

The implementation in Pharo is much more general than the one of
Squeak. Pharo behaves the same as Squeak for two argument blocks on
SequenceableCollection. Squeak does not support anything else.

Lukas

On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:

> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>
> Lukas
>
> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>> it never got merged though.
>>
>> Lukas
>>
>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
>>> hi lukas
>>>
>>> I thought that we introduced the equivalent when we were pair programming at my place.
>>> fold: got introduced in squeak and may be your implementation/API should be pushed there?
>>> Stef
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Stéphane Ducasse

On Jul 21, 2010, at 6:35 PM, Lukas Renggli wrote:

> Now I remember: We called it #reduce: because this is much more common
> among programming languages.

I could not put a name on it too :)


>
> The implementation in Pharo is much more general than the one of
> Squeak. Pharo behaves the same as Squeak for two argument blocks on
> SequenceableCollection. Squeak does not support anything else.
>
> Lukas
>
> On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:
>> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>>
>> Lukas
>>
>> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>>> it never got merged though.
>>>
>>> Lukas
>>>
>>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
>>>> hi lukas
>>>>
>>>> I thought that we introduced the equivalent when we were pair programming at my place.
>>>> fold: got introduced in squeak and may be your implementation/API should be pushed there?
>>>> Stef
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Levente Uzonyi-2
In reply to this post by Lukas Renggli
On Wed, 21 Jul 2010, Lukas Renggli wrote:

> Now I remember: We called it #reduce: because this is much more common
> among programming languages.

Really? http://en.wikipedia.org/wiki/Fold_(higher-order_function)


Levente

>
> The implementation in Pharo is much more general than the one of
> Squeak. Pharo behaves the same as Squeak for two argument blocks on
> SequenceableCollection. Squeak does not support anything else.
>
> Lukas
>
> On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:
>> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>>
>> Lukas
>>
>> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>>> it never got merged though.
>>>
>>> Lukas
>>>
>>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
>>>> hi lukas
>>>>
>>>> I thought that we introduced the equivalent when we were pair programming at my place.
>>>> fold: got introduced in squeak and may be your implementation/API should be pushed there?
>>>> Stef
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Stéphane Ducasse
We will not argue on that one!

Stef

On Jul 21, 2010, at 6:55 PM, Levente Uzonyi wrote:

> On Wed, 21 Jul 2010, Lukas Renggli wrote:
>
>> Now I remember: We called it #reduce: because this is much more common
>> among programming languages.
>
> Really? http://en.wikipedia.org/wiki/Fold_(higher-order_function)
>
>
> Levente
>
>>
>> The implementation in Pharo is much more general than the one of
>> Squeak. Pharo behaves the same as Squeak for two argument blocks on
>> SequenceableCollection. Squeak does not support anything else.
>>
>> Lukas
>>
>> On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:
>>> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>>>
>>> Lukas
>>>
>>> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>>>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>>>> it never got merged though.
>>>>
>>>> Lukas
>>>>
>>>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
>>>>> hi lukas
>>>>>
>>>>> I thought that we introduced the equivalent when we were pair programming at my place.
>>>>> fold: got introduced in squeak and may be your implementation/API should be pushed there?
>>>>> Stef
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> [hidden email]
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Lukas Renggli
>>>> www.lukas-renggli.ch
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Lukas Renggli
In reply to this post by Levente Uzonyi-2
>> Now I remember: We called it #reduce: because this is much more common
>> among programming languages.
>
> Really? http://en.wikipedia.org/wiki/Fold_(higher-order_function)

Yes, reduce is typically used without initial value, while fold is
used with initial value (we already have inject:into: for that).

Lukas

>
>
> Levente
>
>>
>> The implementation in Pharo is much more general than the one of
>> Squeak. Pharo behaves the same as Squeak for two argument blocks on
>> SequenceableCollection. Squeak does not support anything else.
>>
>> Lukas
>>
>> On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:
>>>
>>> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>>>
>>> Lukas
>>>
>>> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>>>>
>>>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>>>> it never got merged though.
>>>>
>>>> Lukas
>>>>
>>>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]>
>>>> wrote:
>>>>>
>>>>> hi lukas
>>>>>
>>>>> I thought that we introduced the equivalent when we were pair
>>>>> programming at my place.
>>>>> fold: got introduced in squeak and may be your implementation/API
>>>>> should be pushed there?
>>>>> Stef
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> [hidden email]
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Lukas Renggli
>>>> www.lukas-renggli.ch
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

Stéphane Ducasse
I like this point so we can include fold: then.

Stef

On Jul 21, 2010, at 7:15 PM, Lukas Renggli wrote:

>>> Now I remember: We called it #reduce: because this is much more common
>>> among programming languages.
>>
>> Really? http://en.wikipedia.org/wiki/Fold_(higher-order_function)
>
> Yes, reduce is typically used without initial value, while fold is
> used with initial value (we already have inject:into: for that).
>
> Lukas
>
>>
>>
>> Levente
>>
>>>
>>> The implementation in Pharo is much more general than the one of
>>> Squeak. Pharo behaves the same as Squeak for two argument blocks on
>>> SequenceableCollection. Squeak does not support anything else.
>>>
>>> Lukas
>>>
>>> On 21 July 2010 18:32, Lukas Renggli <[hidden email]> wrote:
>>>>
>>>> Ahh, it is called #reduce:, #reduceLeft: and #reduceRight: in Pharo.
>>>>
>>>> Lukas
>>>>
>>>> On 21 July 2010 18:27, Lukas Renggli <[hidden email]> wrote:
>>>>>
>>>>> See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
>>>>> it never got merged though.
>>>>>
>>>>> Lukas
>>>>>
>>>>> On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]>
>>>>> wrote:
>>>>>>
>>>>>> hi lukas
>>>>>>
>>>>>> I thought that we introduced the equivalent when we were pair
>>>>>> programming at my place.
>>>>>> fold: got introduced in squeak and may be your implementation/API
>>>>>> should be pushed there?
>>>>>> Stef
>>>>>>
>>>>>> _______________________________________________
>>>>>> Pharo-project mailing list
>>>>>> [hidden email]
>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lukas Renggli
>>>>> www.lukas-renggli.ch
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Lukas Renggli
>>>> www.lukas-renggli.ch
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: fold: ?

NorbertHartl
In reply to this post by Lukas Renggli

On 21.07.2010, at 18:27, Lukas Renggli wrote:

See <http://code.google.com/p/pharo/issues/detail?id=2401>. Looks like
it never got merged though.

The test case for it is a really really nice one. Remembers what is different in smalltalk and smalltalk developers:

array := Array with: Color red with: Color green with: Color blue.
self assert: (array reduce:[:a :b| a + b]) = Color white.

I like this so much.

thanks,

Norbert

Lukas

On 21 July 2010 18:20, Stéphane Ducasse <[hidden email]> wrote:
hi lukas

I thought that we introduced the equivalent when we were pair programming at my place.
fold: got introduced in squeak and may be your implementation/API should be pushed there?
Stef

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project




--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project