Loops and stuff (was Re: Python and Boehm-Demers GC, I have code.)

Markus Kohler markusk at bidra241.bbn.hp.com
Fri Jul 23 10:54:33 EDT 1999


Tim Olson <tim at jumpnet.com> writes:

> Markus Kohler wrote:
> > 
> > Sorry my Smalltalk example is wrong.
> > I must have coded for to long in this poor language called C ...
> > I must look like this :
> > 
> > do: aBlock
> >  a do:[:each | aBlock value: each]
> >  b do:[:each | aBlock value: each]
> > 
> > more complicated but still very easy to understand.
> 
> No, your original code was fine:
> 
> 	do: aBlock
>  		a do: aBlock. 
>  		b do: aBlock. 
> 
> No need to wrap the incoming block in yet another block.
> 
> You could also write it as:
> 
> 	do: aBlock
> 		a , b do: aBlock.
> 

Ah that's cool, 
I didn't have the time to try it out ...
I saw code that used the #value: message
but, of course it has to be only used if you want to do addiotional
things for each element. 

It seems to be  really time to get back to Smalltalk for me ...

Markus
-- 
Markus Kohler  mailto:markus_kohler at hp.com




More information about the Python-list mailing list