calling block from within itself

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

calling block from within itself

Peter Uhnak
Hi,

I want to use a block from within itself... is there a better way than passing itself?
Is there something like self/thisContext I can access?

right now I can do
===============
transformTree := [ :root :block |
    root children do: [ :each |
        each doSomething.
        block value: each value: block
    ]
].

transformTree value: myRoot value: tranformTree.
===============

Thanks,

Peter
Reply | Threaded
Open this post in threaded view
|

Re: calling block from within itself

Sven Van Caekenberghe-2
Hi Peter,

See the section 'How can a block refer to itself ?' in https://medium.com/concerning-pharo/lambda-calculus-in-pharo-a4a571869594

HTH,

Sven

> On 07 Mar 2015, at 13:44, Peter Uhnák <[hidden email]> wrote:
>
> Hi,
>
> I want to use a block from within itself... is there a better way than passing itself?
> Is there something like self/thisContext I can access?
>
> right now I can do
> ===============
> transformTree := [ :root :block |
>     root children do: [ :each |
>         each doSomething.
>         block value: each value: block
>     ]
> ].
>
> transformTree value: myRoot value: tranformTree.
> ===============
>
> Thanks,
>
> Peter


Reply | Threaded
Open this post in threaded view
|

Re: calling block from within itself

Peter Uhnak
Very informative article, thanks!

Peter

On Sat, Mar 7, 2015 at 2:17 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Hi Peter,

See the section 'How can a block refer to itself ?' in https://medium.com/concerning-pharo/lambda-calculus-in-pharo-a4a571869594

HTH,

Sven

> On 07 Mar 2015, at 13:44, Peter Uhnák <[hidden email]> wrote:
>
> Hi,
>
> I want to use a block from within itself... is there a better way than passing itself?
> Is there something like self/thisContext I can access?
>
> right now I can do
> ===============
> transformTree := [ :root :block |
>     root children do: [ :each |
>         each doSomething.
>         block value: each value: block
>     ]
> ].
>
> transformTree value: myRoot value: tranformTree.
> ===============
>
> Thanks,
>
> Peter