<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dj+d</id>
	<title>Kolmafia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dj+d"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Special:Contributions/Dj_d"/>
	<updated>2026-04-25T00:22:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3180</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3180"/>
		<updated>2009-10-04T14:46:13Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= maps =&lt;br /&gt;
Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== assignments ==&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== declarations ==&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
== references ==&lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true &lt;br /&gt;
    boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; &lt;br /&gt;
    animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== contains ==&lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true &lt;br /&gt;
    props contains &amp;quot;elephant&amp;quot; =&amp;gt; false &lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;pet&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== remove ==&lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  string [int] map1;&lt;br /&gt;
  map1[5] = &amp;quot;foo&amp;quot;;&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot;  + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  int [string, string] map2;&lt;br /&gt;
  map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17;&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
  1 true foo&lt;br /&gt;
  remove: foo&lt;br /&gt;
  0 false&lt;br /&gt;
  remove:&lt;br /&gt;
  1 true 17&lt;br /&gt;
  remove: 17&lt;br /&gt;
  0 false 0&lt;br /&gt;
  remove: 0&lt;br /&gt;
  1 aggregate int [string]&lt;br /&gt;
  remove: aggregate int [string]&lt;br /&gt;
  0 aggregate int [string]&lt;br /&gt;
&lt;br /&gt;
== deletion ==&lt;br /&gt;
&lt;br /&gt;
clear (theMap) will remove all entries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== sort ==&lt;br /&gt;
&lt;br /&gt;
From http://kolmafia.us/showthread.php?t=1738&lt;br /&gt;
&lt;br /&gt;
The syntax is:&lt;br /&gt;
sort aggregate by keyExpr;&lt;br /&gt;
aggregate is a reference to the object to be sorted - arrays are probably the most useful things to sort, but any mapping type can be used (even multidimensional maps, but note that you can only sort along a single dimension at a time). The reference must not be enclosed in parentheses, as that would look like a call to a function named sort() - which is still perfectly valid, &amp;quot;sort&amp;quot; has not become a reserved word.&lt;br /&gt;
&lt;br /&gt;
keyExpr is an arbitrary expression that defines how the items should be ordered. It is evaluated once for every entry in the aggregate, in a scope with two additional variables implicitly defined: &#039;index&#039; and &#039;value&#039;, holding the details of that entry. The value of the keyExpr is used as the sort key; typically it would be an int or string, but can be any ASH type that can be compared via &amp;quot;&amp;lt;&amp;quot; and the other relational operators.&lt;br /&gt;
&lt;br /&gt;
The most basic form of sorting would therefore be &amp;quot;sort ... by value&amp;quot;, but many useful things can be done with the use of a more complex keyExpr - the only real restriction is that the expression should not modify the object you&#039;re sorting. For example, if you had an array of items, you could sort it &amp;quot;by autosell_price(value)&amp;quot;. An array of weapon items could be sorted &amp;quot;by -get_power(value)&amp;quot; to put it in decreasing order of power. If the elements of your aggregate are records, you&#039;d need to use something like &amp;quot;by value.fieldName&amp;quot;, since the records themselves can&#039;t be meaningfully compared.&lt;br /&gt;
&lt;br /&gt;
After the sort statement, the aggregate will have exactly the same sets of keys and values as before (even if the keys weren&#039;t consecutive), and the iteration order of the keys will be the same, but the values will likely be associated with different keys. The sort is stable - in other words, elements with sort keys that compare as equal will remain in the same order. This means that you can sort on multiple criteria by simply performing separate sorts for each of the criteria, in increasing order of significance.&lt;br /&gt;
&lt;br /&gt;
A few more examples of things you can do:&lt;br /&gt;
* &amp;quot;by -value&amp;quot; sorts integers in decreasing order (there&#039;s no similar trick for string values).&lt;br /&gt;
* &amp;quot;by -index&amp;quot; reverses the existing order of an array (or map with integer keys).&lt;br /&gt;
* &amp;quot;by random(1000000)&amp;quot; shuffles into a random order.&lt;br /&gt;
* &amp;quot;by otherArray[index]&amp;quot; uses values from a parallel array as the sort keys (you&#039;d then need to do &amp;quot;sort otherArray by value;&amp;quot; if you wanted the two arrays to remain in sync).&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3179</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3179"/>
		<updated>2009-10-04T14:27:51Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= maps =&lt;br /&gt;
Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== assignments ==&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== declarations ==&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
== references ==&lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true &lt;br /&gt;
    boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; &lt;br /&gt;
    animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== contains ==&lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true &lt;br /&gt;
    props contains &amp;quot;elephant&amp;quot; =&amp;gt; false &lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;pet&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== remove ==&lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  string [int] map1;&lt;br /&gt;
  map1[5] = &amp;quot;foo&amp;quot;;&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot;  + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  int [string, string] map2;&lt;br /&gt;
  map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17;&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
  1 true foo&lt;br /&gt;
  remove: foo&lt;br /&gt;
  0 false&lt;br /&gt;
  remove:&lt;br /&gt;
  1 true 17&lt;br /&gt;
  remove: 17&lt;br /&gt;
  0 false 0&lt;br /&gt;
  remove: 0&lt;br /&gt;
  1 aggregate int [string]&lt;br /&gt;
  remove: aggregate int [string]&lt;br /&gt;
  0 aggregate int [string]&lt;br /&gt;
&lt;br /&gt;
== deletion ==&lt;br /&gt;
&lt;br /&gt;
clear (theMap) will remove all entries&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3178</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3178"/>
		<updated>2009-10-04T14:25:46Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true &lt;br /&gt;
    boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; &lt;br /&gt;
    animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true &lt;br /&gt;
    props contains &amp;quot;elephant&amp;quot; =&amp;gt; false &lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;pet&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== remove ==&lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  string [int] map1;&lt;br /&gt;
  map1[5] = &amp;quot;foo&amp;quot;;&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot;  + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  int [string, string] map2;&lt;br /&gt;
  map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17;&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
  1 true foo&lt;br /&gt;
  remove: foo&lt;br /&gt;
  0 false&lt;br /&gt;
  remove:&lt;br /&gt;
  1 true 17&lt;br /&gt;
  remove: 17&lt;br /&gt;
  0 false 0&lt;br /&gt;
  remove: 0&lt;br /&gt;
  1 aggregate int [string]&lt;br /&gt;
  remove: aggregate int [string]&lt;br /&gt;
  0 aggregate int [string]&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3177</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3177"/>
		<updated>2009-10-04T14:25:17Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true &lt;br /&gt;
    boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; &lt;br /&gt;
    animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true &lt;br /&gt;
    props contains &amp;quot;elephant&amp;quot; =&amp;gt; false &lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;pet&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
== remove ==&lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  string [int] map1;&lt;br /&gt;
&lt;br /&gt;
  map1[5] = &amp;quot;foo&amp;quot;;&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
  print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot;  + map1[5] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
&lt;br /&gt;
  int [string, string] map2;&lt;br /&gt;
&lt;br /&gt;
  map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17;&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
  print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
  1 true foo&lt;br /&gt;
  remove: foo&lt;br /&gt;
  0 false&lt;br /&gt;
  remove:&lt;br /&gt;
  1 true 17&lt;br /&gt;
  remove: 17&lt;br /&gt;
  0 false 0&lt;br /&gt;
  remove: 0&lt;br /&gt;
  1 aggregate int [string]&lt;br /&gt;
  remove: aggregate int [string]&lt;br /&gt;
  0 aggregate int [string]&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3176</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3176"/>
		<updated>2009-10-04T14:24:01Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; &lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false;&lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true &lt;br /&gt;
    boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; &lt;br /&gt;
    animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true &lt;br /&gt;
    props contains &amp;quot;elephant&amp;quot; =&amp;gt; false &lt;br /&gt;
    props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;pet&amp;quot; =&amp;gt; true &lt;br /&gt;
    animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
	string [int] map1;&lt;br /&gt;
&lt;br /&gt;
	map1[5] = &amp;quot;foo&amp;quot;;&lt;br /&gt;
	print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] );&lt;br /&gt;
	print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
	print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot;  + map1[5] );&lt;br /&gt;
	print( &amp;quot;remove: &amp;quot; + remove map1[5] );&lt;br /&gt;
&lt;br /&gt;
	int [string, string] map2;&lt;br /&gt;
&lt;br /&gt;
	map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17;&lt;br /&gt;
	print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
	print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
	print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] );&lt;br /&gt;
	print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
	print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
	print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
	print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );&lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
	1 true foo&lt;br /&gt;
	remove: foo&lt;br /&gt;
	0 false&lt;br /&gt;
	remove:&lt;br /&gt;
	1 true 17&lt;br /&gt;
	remove: 17&lt;br /&gt;
	0 false 0&lt;br /&gt;
	remove: 0&lt;br /&gt;
	1 aggregate int [string]&lt;br /&gt;
	remove: aggregate int [string]&lt;br /&gt;
	0 aggregate int [string]&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3175</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3175"/>
		<updated>2009-10-04T14:21:30Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As an example:&lt;br /&gt;
&lt;br /&gt;
    boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false; props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false; props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true; props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
references:&lt;br /&gt;
&lt;br /&gt;
    props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
    props contains &amp;quot;dog&amp;quot; =&amp;gt; true props contains &amp;quot;elephant&amp;quot; =&amp;gt; false props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true animal contains &amp;quot;pet&amp;quot; =&amp;gt; true animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
    remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
    string [int] map1; map1[5] = &amp;quot;foo&amp;quot;; print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] ); print( &amp;quot;remove: &amp;quot; + remove map1[5] ); print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] ); print( &amp;quot;remove: &amp;quot; + remove map1[5] ); int [string, string] map2; map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17; print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] ); print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] ); print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] ); print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );  &lt;br /&gt;
&lt;br /&gt;
yields:&lt;br /&gt;
&lt;br /&gt;
    1 true foo remove: foo 0 false remove: 1 true 17 remove: 17 0 false 0 remove: 0 1 aggregate int [string] remove: aggregate int [string] 0 aggregate int [string]&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3174</id>
		<title>Data Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Structures&amp;diff=3174"/>
		<updated>2009-10-04T14:20:08Z</updated>

		<summary type="html">&lt;p&gt;Dj d: Created page with &amp;#039;Most of this information was copied directly from ASH Maps Tutorial, by Veracity  (http://kolmafia.sourceforge.net/advanced.html#maps)      A map is indexed by one data type (the…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of this information was copied directly from ASH Maps Tutorial, by Veracity &lt;br /&gt;
(http://kolmafia.sourceforge.net/advanced.html#maps)&lt;br /&gt;
&lt;br /&gt;
    A map is indexed by one data type (the key) and associates that key with another (or the same) data type (the value). The key can be any ASH simple data type: boolean, int, float, string, item, zodiac, location, class, stat, skill, effect, familiar, slot, or monster. The value can be any of those or can be an aggregate: another map. This effectively allows multi-dimensional maps and. In fact, that&#039;s how the syntax we provide for multi-dimensional aggregates actually operates: maps of maps of maps ...&lt;br /&gt;
&lt;br /&gt;
    You can declare a map any time you can declare a variable: as a top level (global) variable, as a function parameter, or as a local variable in any scope.&lt;br /&gt;
&lt;br /&gt;
    You can fetch data from a map any time you can provide a data value: in an expression, as a function parameter, on the right side of an assignment statement, from a &amp;quot;return&amp;quot; statement, as so on. You can pass around entire maps, individual elements, or intermediate maps: &amp;quot;slices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
    If you use a map on the left side of an assignment, you set the whole map at once to the new value. If you specify a map and a complete set of indices (of the correct types) on the left side of an assignment statement, you set a single element. If you specify a map and a prefix of indices (of the correct type), you directly set one of the intermediate maps, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
    The syntax for declaring the data type of a map:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;data type&amp;gt; [ &amp;lt;key type&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
    The syntax for referencing an element (or slice) of a map:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;variablename&amp;gt;[ &amp;lt;key expression&amp;gt;, ... ]  &lt;br /&gt;
&lt;br /&gt;
    All the key expressions will be evaluated at run time. If you specify all the keys the map expects, you fetch data of the type specified by the map. If you specify fewer keys than the map expects, you get an intermediate map, a &amp;quot;slice&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
    As an example:&lt;br /&gt;
&lt;br /&gt;
        boolean [string, string] props;  &lt;br /&gt;
&lt;br /&gt;
    might be used to hold &amp;quot;properties&amp;quot; associated with names.&lt;br /&gt;
&lt;br /&gt;
        props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; props[ &amp;quot;dog&amp;quot;, &amp;quot;pet&amp;quot; ] = true; props[ &amp;quot;dog&amp;quot;, &amp;quot;fun&amp;quot; ] = false; props[ &amp;quot;turtle&amp;quot;, &amp;quot;mammal&amp;quot; ] = false; props[ &amp;quot;turtle&amp;quot;, &amp;quot;pet&amp;quot; ] = true; props[ &amp;quot;turtle&amp;quot;, &amp;quot;fun&amp;quot; ] = false; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;mammal&amp;quot; ] = true; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;pet&amp;quot; ] = false; props[ &amp;quot;aardvark&amp;quot;, &amp;quot;fun&amp;quot; ] = true;  &lt;br /&gt;
&lt;br /&gt;
    references:&lt;br /&gt;
&lt;br /&gt;
        props[ &amp;quot;dog&amp;quot;, &amp;quot;mammal&amp;quot;] =&amp;gt; true boolean [string] animal = props[ &amp;quot;turtle&amp;quot; ]; animal[ &amp;quot;fun&amp;quot; ] =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
    You can test the presence of a key in a map using the &amp;quot;contains&amp;quot; operator:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;aggregate reference expression&amp;gt; contains &amp;lt;key expression&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
    Where &amp;lt;aggregate reference expression&amp;gt; must evaluate at run time to a map or slice, and must evaluate at run time to a key of the appropriate type. (Note that that is enforced at parse time; ASH can tell the datatype any expression will produce).&lt;br /&gt;
&lt;br /&gt;
        props contains &amp;quot;dog&amp;quot; =&amp;gt; true props contains &amp;quot;elephant&amp;quot; =&amp;gt; false props[ &amp;quot;aardvark&amp;quot; ] contains &amp;quot;fun&amp;quot; =&amp;gt; true animal contains &amp;quot;pet&amp;quot; =&amp;gt; true animal contains &amp;quot;favorite food&amp;quot; =&amp;gt; false  &lt;br /&gt;
&lt;br /&gt;
    You can remove a key-value association from a map using the &amp;quot;remove&amp;quot; unary operator:&lt;br /&gt;
&lt;br /&gt;
        remove &amp;lt;aggregate reference&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
    For clarification, an aggregate reference is &amp;quot;&amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n&amp;gt; ]&amp;quot; where &amp;lt;map name&amp;gt;[ &amp;lt;index 1&amp;gt; ... &amp;lt;index n-1&amp;gt; ] specifies the &amp;quot;slice&amp;quot; and &amp;lt;index n&amp;gt; specifies the &amp;quot;key&amp;quot;. Which is just what you expect, if you fully specify the indices; for a single dimensional map, &amp;quot;map[10]&amp;quot; -&amp;gt; &amp;quot;map&amp;quot; is the slice and 10 is the key. The &amp;quot;remove&amp;quot; operator removes the &amp;quot;key&amp;quot; from the &amp;quot;slice&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
        string [int] map1; map1[5] = &amp;quot;foo&amp;quot;; print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] ); print( &amp;quot;remove: &amp;quot; + remove map1[5] ); print( count( map1 ) + &amp;quot; &amp;quot; + map1 contains 5 + &amp;quot; &amp;quot; + map1[5] ); print( &amp;quot;remove: &amp;quot; + remove map1[5] ); int [string, string] map2; map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] = 17; print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] ); print( count( map2[&amp;quot;me&amp;quot;] ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] contains &amp;quot;you&amp;quot; + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;,&amp;quot;you&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;, &amp;quot;you&amp;quot;] ); print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] ); print( &amp;quot;remove: &amp;quot; + remove map2[&amp;quot;me&amp;quot;] ); print( count( map2 ) + &amp;quot; &amp;quot; + map2[&amp;quot;me&amp;quot;] );  &lt;br /&gt;
&lt;br /&gt;
    yields:&lt;br /&gt;
&lt;br /&gt;
        1 true foo remove: foo 0 false remove: 1 true 17 remove: 17 0 false 0 remove: 0 1 aggregate int [string] remove: aggregate int [string] 0 aggregate int [string]&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Main_Page&amp;diff=574</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Main_Page&amp;diff=574"/>
		<updated>2009-10-04T14:18:40Z</updated>

		<summary type="html">&lt;p&gt;Dj d: Added data structures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:mafia.jpg]]&amp;lt;center&amp;gt;&lt;br /&gt;
Welcome to the KoLmafia Wiki.&lt;br /&gt;
&lt;br /&gt;
Please pardon our dust while we remodel.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Progress level: [[Special:Statistics|{{NUMBEROFARTICLES}}]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width:80%;margin-top: .7em;background-color:#F4DF3B;border:2px solid #8663A8&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td class=&amp;quot;box_tgen&amp;quot; style=&amp;quot;text-align:cen&lt;br /&gt;
1000&lt;br /&gt;
ter;color:#000;font-size:90%;border:none;margin: 0;padding:.1em;&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Quick Links for ASH Scripters:&#039;&#039;&#039; &amp;lt;br&amp;gt; [[Your Character]] || [[Item Management]] || [[Equipment]] || [[Skills and Effects]] || [[Adventuring]] || [[In-combat functions for consult scripting]] || [[Miscellaneous]]  || [[String Handling Routines]] || [[Control structures]] || [[Data structures]] || [[Datatype Constants]] || [[Datatype Conversions]] || [[KoLmafia Properties]] || [[Code Samples]]&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width: 50%; float: left;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 90%; border: 2px solid black; margin: 5px;&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #b0ddb0; padding: 4px; border-bottom: 1px solid black&amp;quot;&amp;gt;Writing Scripts&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #c0ffc0; padding: 4px;&amp;quot;&amp;gt;&lt;br /&gt;
* [[ASH|ASH Scripts]]&lt;br /&gt;
* [[CLI]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 90%; border: 2px solid black; margin: 5px;&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #b0ddb0; padding: 4px; border-bottom: 1px solid black&amp;quot;&amp;gt;How does Mafia Help?&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #c0ffc0; padding: 4px;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Automation]]&lt;br /&gt;
* [[Quests|Helping with Quests]]&lt;br /&gt;
* [[Basement|Basement Diving]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width: 50%; float: right;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 90%; border: 2px solid black; margin: 5px;&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #aeaeee; padding: 4px; border-bottom: 1px solid black&amp;quot;&amp;gt;Installation&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #bfbfff; padding: 4px;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Windows]]&lt;br /&gt;
* [[Linux]]&lt;br /&gt;
* [[Mac]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 90%; border: 2px solid black; margin: 5px;&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #aeaeee; padding: 4px; border-bottom: 1px solid black&amp;quot;&amp;gt;New User Help&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #bfbfff; padding: 4px;&amp;quot;&amp;gt;&lt;br /&gt;
* Adventuring&lt;br /&gt;
* [[The Relay Browser]]&lt;br /&gt;
* Why use Mafia?&lt;br /&gt;
* [[Helpful Links]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 90%; border: 2px solid black; margin: 5px;&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #aeaeee; padding: 4px; border-bottom: 1px solid black&amp;quot;&amp;gt;Contributing to the Mafia Project&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td style=&amp;quot;background-color: #bfbfff; padding: 4px;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Compiling from Source]]&lt;br /&gt;
* [[Making a Patch]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3126</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3126"/>
		<updated>2009-10-04T01:30:29Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  boolean [int][string] map;&lt;br /&gt;
  map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
  foreach int_index in map&lt;br /&gt;
  {&lt;br /&gt;
    print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
    foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
    { &lt;br /&gt;
      print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
      print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
So the output is&lt;br /&gt;
  15&lt;br /&gt;
  test&lt;br /&gt;
  true&lt;br /&gt;
&lt;br /&gt;
Note that instead of nesting foreach statements, for a multidimensional map, two iterators can be used inline.&lt;br /&gt;
  foreach x,y in map&lt;br /&gt;
is identical to&lt;br /&gt;
  foreach x in map&lt;br /&gt;
  {&lt;br /&gt;
    foreach y in map[x]&lt;br /&gt;
  }&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for more details on maps.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3125</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3125"/>
		<updated>2009-10-03T18:12:30Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  boolean [int][string] map;&lt;br /&gt;
  map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
  foreach int_index in map&lt;br /&gt;
  {&lt;br /&gt;
    print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
    foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
    { &lt;br /&gt;
      print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
      print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
So the output is&lt;br /&gt;
  15&lt;br /&gt;
  test&lt;br /&gt;
  true&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3124</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3124"/>
		<updated>2009-10-03T18:12:12Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  boolean [int][string] map;&lt;br /&gt;
  map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
  foreach int_index in map&lt;br /&gt;
  {&lt;br /&gt;
    print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
    foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
    { &lt;br /&gt;
      print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
      print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
So the output is&lt;br /&gt;
15&lt;br /&gt;
test&lt;br /&gt;
true&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3123</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3123"/>
		<updated>2009-10-03T18:11:51Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  boolean [int][string] map;&lt;br /&gt;
  map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
  foreach int_index in map&lt;br /&gt;
  {&lt;br /&gt;
  print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
  foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
  { &lt;br /&gt;
    print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
    print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
So the output is&lt;br /&gt;
15&lt;br /&gt;
test&lt;br /&gt;
true&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3122</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3122"/>
		<updated>2009-10-03T18:10:17Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
boolean [int][string] map;&lt;br /&gt;
map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
foreach int_index in map&lt;br /&gt;
{&lt;br /&gt;
  print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
  foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
  { &lt;br /&gt;
    print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
    print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
So the output is&lt;br /&gt;
15&lt;br /&gt;
test&lt;br /&gt;
true&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3121</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3121"/>
		<updated>2009-10-03T18:08:49Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* foreach */  Added example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;map&amp;quot; must be an aggregate - a map or a slice.  x takes on each value of the map index in turn.  If there is more than one index, x iterates over the first index. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
boolean [int][string] map;&lt;br /&gt;
map[15][&amp;quot;test&amp;quot;] = true;&lt;br /&gt;
foreach int_index in map&lt;br /&gt;
{&lt;br /&gt;
  print(int_index); //this will print &#039;15&#039; once, since there is only one valid value for this index&lt;br /&gt;
  foreach string_index in map[int_index] //this iterates over the &amp;quot;slice&amp;quot; of the map where 1 is fixed as the index&lt;br /&gt;
  { &lt;br /&gt;
    print(string_index); //This will print &amp;quot;test&amp;quot; once, since there is only one valid value for this index&lt;br /&gt;
    print(map[int_index][string_index]); //this will print &amp;quot;true&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
So the output is&lt;br /&gt;
15&lt;br /&gt;
test&lt;br /&gt;
true&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3120</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3120"/>
		<updated>2009-10-03T17:47:12Z</updated>

		<summary type="html">&lt;p&gt;Dj d: added repeat/until&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== repeat until ==&lt;br /&gt;
repeat&lt;br /&gt;
{}&lt;br /&gt;
until (boolean)&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3119</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3119"/>
		<updated>2009-09-27T05:53:07Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* for */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3118</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3118"/>
		<updated>2009-09-27T05:50:27Z</updated>

		<summary type="html">&lt;p&gt;Dj d: /* for */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
If x was previously defined, whatever value it had is restored when the for loop completes.&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3117</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3117"/>
		<updated>2009-09-27T05:41:39Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.  The first iteration is at a and the last is at b (that is to say, it goes from a to b, inclusive).&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3116</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3116"/>
		<updated>2009-09-27T03:13:36Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.&lt;br /&gt;
&lt;br /&gt;
== foreach ==&lt;br /&gt;
foreach x in map&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
See http://kolmafia.sourceforge.net/advanced.html#maps for details.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3115</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3115"/>
		<updated>2009-09-27T03:11:47Z</updated>

		<summary type="html">&lt;p&gt;Dj d: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else if&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3114</id>
		<title>Control Structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Control_Structures&amp;diff=3114"/>
		<updated>2009-09-27T03:11:28Z</updated>

		<summary type="html">&lt;p&gt;Dj d: Filled out some basics.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== if/else ==&lt;br /&gt;
if (boolean)&lt;br /&gt;
{}&lt;br /&gt;
else if&lt;br /&gt;
{}&lt;br /&gt;
else&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
== while ==&lt;br /&gt;
while (boolean)&lt;br /&gt;
{}&lt;br /&gt;
== for ==&lt;br /&gt;
for x from a to b by c&lt;br /&gt;
&lt;br /&gt;
is the general case. You don&#039;t need to specify whether it&#039;s going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn&#039;t screw up.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specify &amp;quot;c&amp;quot;, it defaults to incrementing/decrementing by 1.&lt;/div&gt;</summary>
		<author><name>Dj d</name></author>
	</entry>
</feed>