How to return array keys into another array
adrian voss
adrian.voss at ntlworld.com
Thu Jun 10 23:03:04 UTC 2004
Hi, thank you all for the advice. Reason for using the indices is that in
this instance they refer to the seat numbers in a fictitious reservation
program for a course I am on. The question asked for arrays to be used.
I really hope that there is an easier way to do this because this had me
stumped.
Again, thanks for your time.
Adrian
-----Original Message-----
From: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-bounces at lists.squeakfoundation.org] On Behalf Of Tim
Rowledge
Sent: 10 June 2004 20:16
To: squeak-dev at lists.squeakfoundation.org
Subject: Re: How to return array keys into another array
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.
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 04/06/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 04/06/2004
More information about the Squeak-dev
mailing list
|