[squeak-dev] The Object>>recurse: Method

Frank Shearar frank.shearar at gmail.com
Fri May 27 20:55:09 UTC 2016


On 27 May 2016 at 10:42, Kjell Godo <squeaklist at gmail.com> wrote:

> Object>>recurse: aZeroInputValuable"ThatReturnsATwoInputValuable"
>
> ^( aZeroInputValuable value
>  ) value:( self )value:[ :anObject | anObject recurse: aZeroInputValuable ]
>
> "Object>>recurse:
>
> does for recursion what >>do: does for iteration
>
> it enables any Object O to do recursion
> Without writing a new recursive method in the Class of O
>

Yep. Unless my eyes deceive me, that's the Y combinator. You can see a more
classically academic implementation at
https://rosettacode.org/wiki/Y_combinator#Smalltalk

frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160527/c858a8bc/attachment.htm


More information about the Squeak-dev mailing list