| description | Mold generators for common container types including maps, sets, queues, jars, and jugs. | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| layout |
|
$mold generator. A +jar is a +map of +list.
Produces the $mold of a +map from key to lists of value.
$key is a $mold, and is the type of the +map key.
$value is a $mold, and is the type of items in the lists. The lists are the values in the +map.
A $mold.
++ jar |$ [key value] (map key (list value))> `(jar @t @ud)`(malt ~[['foo' ~[1 2 3]] ['bar' ~[4 5 6]]])
{[p='bar' q=~[4 5 6]] [p='foo' q=~[1 2 3]]}
See also: +ja, +by, +map, +lists.
$mold generator. Produces a +jug, which is a (map key (set value)).
$key is a $mold, and is the type of the +map key.
$value is a $mold, and is the type of items in the +sets. The +sets are the values in the +map.
A $mold.
++ jug |$ [key value] (map key (set value))> `(jug @t @ud)`(malt ~[['foo' (silt ~[1 2 3])] ['bar' (silt ~[4 5 6])]])
{[p='bar' q={5 6 4}] [p='foo' q={1 2 3}]}
See also: +ju, +by, +map, +set.
A +map is a treap of key-value pairs.
Produces the $mold of a +map from key to value.
$key is a $mold.
$value is a $mold.
A $mold.
++ map
|$ [key value]
$| (tree (pair key value))
|=(a=(tree (pair)) ?:(=(~ a) & ~(apt by a)))> ? *(map @t @ud)
nlr([p=@t q=@ud])
{}
> `(map @t @ud)`(malt ~[['foo' 1] ['bar' 2] ['baz' 3]])
{[p='bar' q=2] [p='baz' q=3] [p='foo' q=1]}
See also: +by.
Queue.
$mold generator. An ordered treap of items.
Produces the $mold of a queue of $item.
$item is a $mold.
A $mold.
++ qeu
|$ [item]
$| (tree item)
|=(a=(tree) ?:(=(~ a) & ~(apt to a)))> `(qeu @ud)`(~(gas to *(qeu @ud)) ~[1 2 3 4 5])
{5 4 3 2 1}
See also: +to.
Set.
$mold generator. A +set is an unordered treap of items.
Produces the $mold of a +set of $item.
$item is a $mold.
A $mold.
++ set
|$ [item]
$| (tree item)
|=(a=(tree) ?:(=(~ a) & ~(apt in a)))> `(set @ud)`(silt ~[1 2 3 4 5])
{5 1 2 3 4}
See also: +in.