[quote author=Presto Ragu link=topic=289.msg1676#msg1676 date=1153889291]I personally despise the idea of having to define multiple maps for multiple pieces of data about the same "object." Perhaps it is my stubbornness... But when Veracity claimed that maps were much more usefull than arrays, I expected them to behave similarly.[/quote]
I believe that my position was that you can do anything with a map that you can with an array, and more. Nothing you've said makes me want to change that position.
[quote author="Presto Ragu"]What I had in mind was a multiple dimension map that held all of the usefull information about foods and drinks.
For example:
Code:
item [int, stat, int, int] FoodItem;
FoodItem [<fullness>, <main stat increase, if any>, <minimum adventures gained>, <maximum adventures gained>] = $item[<whatever>];
[/quote]
You are asking, essentially, for data structures, and for a map to be able to go from item to your structure.
You can get the effect you want, today, using maps as they exist in ASH.
Nightmist told you exactly how to do it.
int [item, string] map;
map[ $item[foo], "fullness" ] = 2;
map[ $item[foo], "min stat increase" ] = 5;
map[ $item[foo], "max stat increase" ] = 10;
map[ $item[foo], "min adventure gained" ] = 6;
map[ $item[foo], "max adventure gained" ] = 16;
Since you seem to be using "arrays" as your model for what you seek, this is the equivalent of you having an array of <n> integers, and the value you fetch from the map is such an array. The second index of the map is the index into your array.
Since you refer to "old school" thinking, you'd probably do it like this:
int FULLNESS = 0;
int MIN_ADVENTURES = 1;
int MAX_ADVENTURES = 2;
int [ item, int] map;
map[ $item[foo], FULLNESS ] = 3;
map[ $item[foo], MIN_ADVENTURES ] = 6;
map[ $item[foo], MAX_ADVENTURES ] = 16;
...which has precisely the same effect as what was done above with a string as the second index.
Now, if you wanted different data types - integers, stats, whatever - then you couldn't store them in a single map. You could not say:
map[ $item[foo], "stat" ] = $stat[muscle];
to store a "stat" in your map whose values are ints.
But then again, you couldn't store them in a single array in most languages, either. You would need a data structure:
struct x {
int field1;
stat field 2;
item field 3
...
};
However, since you mention "arrays" as what you want the power of, this is moot; it's more than an "array" would give you.
[quote author="Presto Ragu"]This would allow the user to reference almost any data that they wanted related to a food item. You would be able to average the adventure gain, and divide by the fullness in order to get the adventures per fullness if you want.[/quote]
Go for it. Use ASH maps as they exist today to hold the three integers you mention, indexed by item and by string, as described above.
[quote author="Presto Ragu"]But I guess I am too old school to see how maps are better than arrays yet...

[/quote]
I can give you examples of things that you can do with an ASH map that you can't do with an "array". But so far you have failed to give an example of something you can do with an "array" that you can't do with an ASH map.