Task

The goal is to create an associative array (also known as a dictionary, map, or hash).



Related tasks:

 Associative arrays/Iteration
 Hash from two arrays


See also

 Array
 Associative array: Creation, Iteration
 Collections
 Compound data type
 Doubly-linked list: Definition, Element definition, Element insertion, List Traversal, Element Removal
 Linked list
 Queue: Definition, Usage
 Set
 Singly-linked list: Element definition, Element insertion, List Traversal, Element Removal
 Stack


 
* Iterate over key-value pairs of a map
 
    map = new('map 1:one 2:two 3:three')
 
visit(domain(map),'expr to evaluate for each member')
 
visit(range(map),'expr to evaluate for each member')
 
    next 
        this = next(map)             :f(done)
        out(show(this) ':' show(get(map,this)) :next)
    done
 
    loop(d = domain(map)
 
    next
        out('next domain entry',next(d))    :s(next)
    done
 
    loop(d = range(map)
 
    next
        out('next domain entry',next(d))    :s(next)
    done
 