logo       

Re: block in recursion, Any cure for that kind of situation?: msg#00100

lang.smalltalk.squeak.beginners

Subject: Re: block in recursion, Any cure for that kind of situation?

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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
Beginners@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/mailman/listinfo/beginners
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise