on c19bc7a help sign in
114 lines 1.5 kB history raw
1:- :~ navhome/'/docs/'
2 sort/'15'
3 title/'2l: Container from Container'
4 ==
6;>
8# 2l: container from container
10### `++malt`
12Map from list
14Produces a map from a list `a`.
16#### Accepts
18`a` is a list.
20#### Produces
22A map.
24#### Source
26```
27:- :~ navhome/'/docs/'
28 sort/'14'
29 title/'2k: Jar and Jug Logic'
30 ==
32;>
33```
35#### Examples
37```
38 > (malt [['ok' 'no'] ['a' 'b'] ['x' 'y'] ~])
39 [n=[p='x' q='y'] l={[p='a' q='b'] [p='ok' q='no']} r={}]
41 > (malt ~[[1 2 3] [4 5 6] [7 8 9]])
42 [n=[p=1 q=[2 3]] l={[p=4 q=[5 6]] [p=7 q=[8 9]]} r={}]
43```
45---
46### `++molt`
48Map from pair list
50Produces a map from a list of pairs `a`.
52#### Accepts
54`a` is a list of pairs.
56#### Produces
58A map.
60#### Source
62```
63 ++ molt
64 |* a=(list (pair))
65 (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a})`~) a)
66```
68#### Examples
70```
71 > =a `(list (pair))`[[1 2] [4 3] [11 0] ~]
72 > a
73 > ~[[p=1 q=2] [p=4 q=3] [p=11 q=0]]
75 > (molt a)
76 [n=[p=11 q=0] l={[p=4 q=3] [p=1 q=2]} r={}]
77```
79#### Discussion
81Only used internally as a helper to `malt`.
83---
84### `++silt`
86Set from list
88Produces a set from a list `a`.
90#### Accepts
92`a` is a list.
94#### Produces
96A set.
98#### Source
100```
101 ++ silt
102 |* a=(list)
103 =+ b=*(tree _?>(?=(^ a) i.a))
104 (~(gas in b) a)
105```
107#### Examples
109```
110 > (silt `(list @t)`['c' 'hoon' 'javascript' 'python' ~])
111 [n='javascript' l={} r={'python' 'hoon' 'c'}]
112```
114---