How to return array keys into another array
Tim Rowledge
tim at sumeru.stanford.edu
Thu Jun 10 18:33:46 UTC 2004
> a := Array with: 'free' with: 'reserved' with: 'free' with: 'reserved'.
> a2 := ((1 to: a size) inject: OrderedCollection new into: [ :oc :i | (a at:
> i) = 'free' ifTrue: [ oc add: i ]. oc ]) asArray.
How about
a2 := a select:[:i| i = 'free]
?
tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Microwave: Signal from a friendly micro...
More information about the Squeak-dev
mailing list
|