How to return array keys into another array
Tim Rowledge
tim at sumeru.stanford.edu
Thu Jun 10 19:16:07 UTC 2004
Avi Bryant <avi at beta4.com> wrote:
> > How about
> > a2 := a select:[:i| i = 'free]
>
> No, because he wanted the indices, not the actual values.
D'h. Missed the key bit.
However, I
> suspect this isn't the whole story; it's unusual enough to deal with
> array indices directly that I wonder what the final goal is here, and
> whether there might be some better way of achieving it...
It's pretty unlikely that a sensible design would need the indices.
Tell us more about the problem - this is probably a good learning
opportunity.
tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- Answers the door when the phone rings.
More information about the Squeak-dev
mailing list
|