Declined Associative arrays

May 20, 2008
12,167
133
Syracuse, NY, USA
Title text = "
Associative arrays
"
That's rather abstract. An example of what's actually desired would be in order. Do you mean (simply) a one-dimensional array indexed by arbitrary strings, with addition, deletion, lookup, and modification capabilities? Really ... does anyone have something concrete in mind? How about ...

Code:
aarray streetnums
aarray /add streetnums "Vince" "1067"
echo Vince's street number is %streetnums["Vince"]

That's pretty simple-minded. On the surface, it doesn't allow iteration over the existing indices (which might be desirable).

I have seen the STL's "map" class mentioned in connection with such things.
 
Jan 19, 2011
614
15
Norman, OK
Oh come on! You know you've got that DWIM parser right there, waiting in the wings! :-P

(gotcha, I saw the light after reading Vince's reply)