[Newbies] block in recursion, Any cure for that kind of situation?

Marcin Tustin mm3 at zepler.net
Tue Jan 22 22:12:22 UTC 2008


For the avoidance of confusion, here is a version with non-guessed syntax:

f := [:a :ff | a ifTrue: [{a . (ff value: (a not) value: ff)}] ifFalse: a].
g := [:a :ff | a ifTrue: [{a . (ff value: (a not) value: ff)}] ifFalse: a].
f value: true value: g.

On Jan 22, 2008 9:35 PM, Marcin Tustin <mm3 at zepler.net> wrote:

> You could add an extra parameter that is another block. Use that parameter
> as the value of carre in the block. something like:
>
> f := [:a :ff | a ifTrue: [ff (a not) ff] ]
> ff: = [:a :ff | a ifTrue: [ff (a not) ff] ]
>
>
> On Jan 22, 2008 9:10 PM, Hilaire Fernandes <hilaire at ofset.org> wrote:
>
> > I got an error "Attempt to evaluate a block that is already being
> > evaluated", when I call in recursion a block like
> >
> > carre := [:s1 :s2 :s3 :s4 :n |
> >        n >0 ifTrue:
> >                [carre valueWithArguments:  {(segment value: s1 value:
> > s2).
> >                         (segment value: s2 value: s3).
> >                         (segment value: s3 value: s4).
> >                         (segment value: s1 value: s4).
> >                         n-1}]]
> >
> > Hilaire
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080122/b85aa7b0/attachment.htm


More information about the Beginners mailing list