[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yet another Map question
From: |
Paul E Johnson |
Subject: |
Re: yet another Map question |
Date: |
Sun, 22 Oct 2000 15:52:58 -0500 |
Ken Gosier wrote:
>
> Paul E Johnson wrote:
> While I'm iterating through the Map: Say I don't care about modifying
> the contents of the keys, but I do need to access those contents. May I
> then just use the format:
>
> for (val=[mapIndex next: key]; [mapIndex getLoc]==Member;
> val=[mapIndex next: key])
>
> That is, without having to say &key ?
I think we are talking past eachother. mapIndex adopts several
protocols. If you just want to grab the next object, you don't need to
refer to the key at all, you can just do
for (val = [mapIndex next]; [mapIndex getLoc]==Member; val=[mapIndex
next)
{ do whatever you want to the val in here;}
If you ever need to find the key for the object you are currently
working on, ask for it with
aKey = [mapIndex getKey];
If it is important to save the key valuess, I'm looking in the swarm
source for usage examples. In collections/Map.m, there is this sort of
usage.
id <mapIndex> key;
for (val=[mapIndex next: &key]; [mapIndex getLoc]==Member;
val=[mapIndex next: &key])
{
if you want to ask the key object to do something, all you need is:
[key execute this method ];
}
Since the think is declared as a id, then you can use it that way.
I did a lot of work on the ASM and I like your idea very much. Good
luck. Are you working with the ASM codebase from
ArtStkMkt.sourceforge.net? If so, perhaps we can merge your successes
(!) back into that public code base, after you make your first million
trading with your model, that is.
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.