| description | Functions for converting between container types like lists, maps, and sets. | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| layout |
|
A +map from a +list.
Produces a +map from a +list .a.
.a is a +list.
A +map.
++ malt :: map from list
|* a=(list)
(molt `(list [p=_-<.a q=_->.a])`a)> (malt [['ok' 'no'] ['a' 'b'] ['x' 'y'] ~])
[n=[p='x' q='y'] l={[p='a' q='b'] [p='ok' q='no']} r={}]
> (malt ~[[1 2 3] [4 5 6] [7 8 9]])
[n=[p=1 q=[2 3]] l={[p=4 q=[5 6]] [p=7 q=[8 9]]} r={}]
A +map from pair +list.
Produces a +map from a +list of pairs .a.
.a is a +list of pairs.
A +map.
++ molt
|* a=(list (pair))
(~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a])`~) a)> =a `(list (pair))`[[1 2] [4 3] [11 0] ~]
> a
> ~[[p=1 q=2] [p=4 q=3] [p=11 q=0]]
> (molt a)
[n=[p=11 q=0] l={[p=4 q=3] [p=1 q=2]} r={}]
Only used internally as a helper to +malt.
A +set from a +list.
Produces a +set from a +list .a.
.a is a +list.
A +set.
++ silt
|* a=(list)
=+ b=*(tree _?>(?=(^ a) i.a))
(~(gas in b) a)> (silt `(list @t)`['c' 'hoon' 'javascript' 'python' ~])
[n='javascript' l={} r={'python' 'hoon' 'c'}]