Bug in nested iterations? (was: What is wrong with this?)

Scott Wallace scott.wallace at squeakland.org
Thu May 26 05:12:03 UTC 2005


At 2:15 PM +1000 5/26/05, Joaquin Sitte wrote:
>
>This explains the behaviour. But this does not seem to be a terribly 
>useful way of doing things, at least not for my purpose. What is the 
>proper way to define a  separate vector for every element in the map?


Hi Joaquin,

One simple way would be...

1 to: map size do:
	[:i | map at: i put: (FloatArray new: 4)]

Cheers,

  -- Scott

--------

>  >> map_ Som new: 30
>
>  >> map from: 1 to: map size put: (FloatArray new: 4).
>
>  >  This sets it up so that only one FloatArray instance is created and
>
>  >it will be pointed to by all the 30 slots of 'map' object.
>
>  >  (map first identityHash) = (map last identityHash)
>
>  >will be true.
>
>This explains the behaviour. But this does not seem to be a terribly 
>useful way of doing things, at least not for my purpose. What is the 
>proper way to define a  separate vector for every element in the map?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050525/9224637f/attachment.htm


More information about the Squeak-dev mailing list