on master help sign in
thru 2j
a46278fHenry Ault
docs/system/hoon/library/src/2i/core/.by.md.swo

Binary file not shown.

docs/system/hoon/library/src/2i/core/by.md+73−67
@@ -38,10 +38,10 @@ Computes the logical AND on the results of slamming every element in map
38
38
39`b` is a wet gate.
39`b` is a wet gate.
40
40
41− ~zod/try=> =b (mo `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
41+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
42 ~zod/try=> (~(all by b) |=(a/* ?@(a & |)))
42 ~zod/try=> (~(all by b) |=(a/* ?@(a & |)))
43 %.n
43 %.n
44− ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
44+ ~zod/try=> =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
45 ~zod/try=> (~(all by a) |=(a/@ (lte a 6)))
45 ~zod/try=> (~(all by a) |=(a/@ (lte a 6)))
46 %.y
46 %.y
47 ~zod/try=> (~(all by a) |=(a/@ (lte a 4)))
47 ~zod/try=> (~(all by a) |=(a/@ (lte a 4)))
@@ -68,10 +68,10 @@ gate `b`. Produces a loobean.
68
68
69`b` is a wet gate.
69`b` is a wet gate.
70
70
71− ~zod/try=> =b (mo `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
71+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
72− ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
72+ ~zod/try=> (~(all by b) |=(a/* ?@(a & |)))
73 %.y
73 %.y
74− ~zod/try=> =a (mo `(list [@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
74+ ~zod/try=> =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
75 ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
75 ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
76 %.y
76 %.y
77
77
@@ -105,7 +105,7 @@ Produces map `a` with the element located at key `b` removed.
105
105
106`b` is a key as a noun.
106`b` is a key as a noun.
107
107
108− ~zod/try=> =b (mo `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
108+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
109 ~zod/try=> (~(del by b) `a`)
109 ~zod/try=> (~(del by b) `a`)
110 {[p=`b` q=[2 3]]}
110 {[p=`b` q=[2 3]]}
111
111
@@ -133,7 +133,7 @@ Produce the axis of key `b` within map `a`.
133
133
134`b` is a key as a noun.
134`b` is a key as a noun.
135
135
136− ~zod/try=> =b (mo `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
136+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
137 ~zod/try=> (~(dig by b) `b`)
137 ~zod/try=> (~(dig by b) `b`)
138 [~ 2]
138 [~ 2]
139
139
@@ -145,21 +145,22 @@ Concatenate
145
145
146 +- gas :: concatenate
146 +- gas :: concatenate
147 ~/ %gas
147 ~/ %gas
148− |* b=(list ,[p=* q=*])
149− => .(b `(list ,_?>(?=(^ a) n.a))`b)
148+ |= b/(list _?>(?=(^ a) n.a))
150 |- ^+ a
149 |- ^+ a
151 ?~ b
150 ?~ b
152 a
151 a
153− $(b t.b, a (put(+< a) p.i.b q.i.b))
152+ $(b t.b, a (put i.b))
153+ ::
154+
154
155
155Insert a list of key-value pairs `b` into map `a`.
156Insert a list of key-value pairs `b` into map `a`.
156
157
157−`a` is a [map]().
158+`a` is a map.
158
159
159−`b` is a [list]() of [cells]() of key-value nouns `p` and `q`.
160+`b` is a list of cells of key-value nouns `p` and `q`.
160
161
161− ~zod/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
162+ ~zod/try=> =a (mo `(list {@t *})`[[`a` 1] [`b` 2] ~])
162− ~zod/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~]
163+ ~zod/try=> =b `(list {@t *})`[[`c` 3] [`d` 4] ~]
163 ~zod/try=> (~(gas by a) b)
164 ~zod/try=> (~(gas by a) b)
164 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
165 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
165
166
@@ -183,11 +184,11 @@ Grab unit value
183
184
184Produce the unit value of the value located at key `b` within map `a`.
185Produce the unit value of the value located at key `b` within map `a`.
185
186
186−`a` is a [map]()
187+`a` is a map
187
188
188−`b` is a [key]() as a [noun]()
189+`b` is a key as a noun
189
190
190− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
191+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
191 ~zod/try=> (~(get by b) `b`)
192 ~zod/try=> (~(get by b) `b`)
192 [~ [2 3]]
193 [~ [2 3]]
193
194
@@ -198,18 +199,17 @@ Produce the unit value of the value located at key `b` within map `a`.
198Assert
199Assert
199
200
200 +- got
201 +- got
201− |* b=*
202+ |* b/*
202− %- need
203+ (need (get b))
203− %- get(+< a) b
204
204
205Produce the value located at key `b` within map `a`. Crash if key `b`
205Produce the value located at key `b` within map `a`. Crash if key `b`
206does not exist.
206does not exist.
207
207
208−`a` is a [map]().
208+`a` is a map.
209
209
210−`b` is a [key]().
210+`b` is a key.
211
211
212− ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' 2] ~])
212+ ~zod/try=> =m (mo `(list {@t *})`[['a' 1] ['b' 2] ~])
213 ~zod/try=> m
213 ~zod/try=> m
214 {[p='a' q=1] [p='b' q=2]}
214 {[p='a' q=1] [p='b' q=2]}
215 ~zod/try=> (~(get by m) 'a')
215 ~zod/try=> (~(get by m) 'a')
@@ -227,17 +227,18 @@ Key existence check
227
227
228 +- has :: key existence check
228 +- has :: key existence check
229 ~/ %has
229 ~/ %has
230− |* b=*
230+ |* b/*
231− !=(~ (get(+< a) b))
231+ !=(~ (get b))
232+
232
233
233Checks whether map `a` contains an element with key `b`, producing a
234Checks whether map `a` contains an element with key `b`, producing a
234loobean.
235loobean.
235
236
236−`a` is a [map]().
237+`a` is a map.
237
238
238−`b` is a key as a [noun]().
239+`b` is a key as a noun.
239
240
240− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
241+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
241 ~zod/try=> (~(has by b) `b`)
242 ~zod/try=> (~(has by b) `b`)
242 %.y
243 %.y
243 ~zod/try=> (~(has by b) `c`)
244 ~zod/try=> (~(has by b) `c`)
@@ -251,7 +252,7 @@ Intersection
251
252
252 +- int :: intersection
253 +- int :: intersection
253 ~/ %int
254 ~/ %int
254− |* b=_a
255+ |* b/_a
255 |- ^+ a
256 |- ^+ a
256 ?~ b
257 ?~ b
257 ~
258 ~
@@ -260,41 +261,42 @@ Intersection
260 ?: (vor p.n.a p.n.b)
261 ?: (vor p.n.a p.n.b)
261 ?: =(p.n.b p.n.a)
262 ?: =(p.n.b p.n.a)
262 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
263 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
263− ?: (hor p.n.b p.n.a)
264+ ?: (gor p.n.b p.n.a)
264− %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
265+ %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
265− %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
266+ %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
266 ?: =(p.n.a p.n.b)
267 ?: =(p.n.a p.n.b)
267 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
268 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
268− ?: (hor p.n.a p.n.b)
269+ ?: (gor p.n.a p.n.b)
269− %- uni(+< $(b l.b, a [n.a l.a ~])) $(a r.a)
270+ %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
270− %- uni(+< $(b r.b, a [n.a ~ r.a])) $(a l.a)
271+ %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
272+ ::
271
273
272Produces a map of the (key) intersection between two maps of the same
274Produces a map of the (key) intersection between two maps of the same
273type, `a` and `b`. If both maps have an identical key that point to
275type, `a` and `b`. If both maps have an identical key that point to
274different values, the element from map `b` is used.
276different values, the element from map `b` is used.
275
277
276−`a` is a [map]().
278+`a` is a map.
277
279
278−`b` is a [map]().
280+`b` is a map.
279
281
280− ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 3] ~])
282+ ~zod/try=> =n (mo `(list {@t *})`[['a' 1] ['c' 3] ~])
281 ~zod/try=> n
283 ~zod/try=> n
282 {[p='a' q=1] [p='c' q=3]}
284 {[p='a' q=1] [p='c' q=3]}
283 ~zod/try=> m
285 ~zod/try=> m
284 {[p='a' q=1] [p='b' q=2]}
286 {[p='a' q=1] [p='b' q=2]}
285 ~zod/try=> (~(int by m) n)
287 ~zod/try=> (~(int by m) n)
286 {[p='a' q=1]}
288 {[p='a' q=1]}
287− ~ravpel-holber/try=> =p (mo `(list ,[@t *])`[['a' 2] ['b' 2] ~])
289+ ~ravpel-holber/try=> =p (mo `(list {@t *})`[['a' 2] ['b' 2] ~])
288 ~zod/try=> p
290 ~zod/try=> p
289 {[p='a' q=2] [p='b' q=2]}
291 {[p='a' q=2] [p='b' q=2]}
290 ~zod/try=> (~(int by p) n)
292 ~zod/try=> (~(int by p) n)
291 {[p='a' q=2]}
293 {[p='a' q=2]}
292− ~zod/try=> =q (mo `(list ,[@t *])`[['a' 2] ['c' 2] ~])
294+ ~zod/try=> =q (mo `(list {@t *})`[['a' 2] ['c' 2] ~])
293 ~zod/try=> q
295 ~zod/try=> q
294 {[p='a' q=2] [p='b' q=2]}
296 {[p='a' q=2] [p='b' q=2]}
295 ~zod/try=> (~(int by p) q)
297 ~zod/try=> (~(int by p) q)
296 {[p='a' q=2] [p='b' q=2]}
298 {[p='a' q=2] [p='b' q=2]}
297− ~zod/try=> =o (mo `(list ,[@t *])`[['c' 3] ['d' 4] ~])
299+ ~zod/try=> =o (mo `(list {@t *})`[['c' 3] ['d' 4] ~])
298 ~zod/try=> (~(int by m) o)
300 ~zod/try=> (~(int by m) o)
299 {}
301 {}
300
302
@@ -343,7 +345,7 @@ Add key-value pair
343
345
344 +- put :: adds key-value pair
346 +- put :: adds key-value pair
345 ~/ %put
347 ~/ %put
346− |* [b=* c=*]
348+ |* {b/* c/*}
347 |- ^+ a
349 |- ^+ a
348 ?~ a
350 ?~ a
349 [[b c] ~ ~]
351 [[b c] ~ ~]
@@ -362,10 +364,11 @@ Add key-value pair
362 ?: (vor p.n.a p.n.d)
364 ?: (vor p.n.a p.n.d)
363 [n.a l.a d]
365 [n.a l.a d]
364 [n.d [n.a l.a l.d] r.d]
366 [n.d [n.a l.a l.d] r.d]
367+ ::
365
368
366Produces `a` with the addition of the key-value pair of `b` and `c`.
369Produces `a` with the addition of the key-value pair of `b` and `c`.
367
370
368−`a` is a [map]().
371+`a` is a map.
369
372
370`b` is a key of the same type as the keys in `a`.
373`b` is a key of the same type as the keys in `a`.
371
374
@@ -386,10 +389,11 @@ Produces `a` with the addition of the key-value pair of `b` and `c`.
386### `+-rep:by`
389### `+-rep:by`
387
390
388 +- rep :: replace by product
391 +- rep :: replace by product
389− |* [b=* c=_,*]
392+ |* b/_|=({* *} +<+)
390 |-
393 |-
391− ?~ a b
394+ ?~ a +<+.b
392− $(a r.a, b $(a l.a, b (c q.n.a b)))
395+ $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
396+ ::
393
397
394Accumulate using gate from values in map
398Accumulate using gate from values in map
395
399
@@ -400,7 +404,7 @@ XX interface changing.
400### `+-rib:by`
404### `+-rib:by`
401
405
402 +- rib :: transform + product
406 +- rib :: transform + product
403− |* [b=* c=_,*]
407+ |* {b/* c/$-(* *)}
404 |- ^+ [b a]
408 |- ^+ [b a]
405 ?~ a [b ~]
409 ?~ a [b ~]
406 =+ d=(c n.a b)
410 =+ d=(c n.a b)
@@ -408,6 +412,7 @@ XX interface changing.
408 =+ e=$(a l.a, b -.d)
412 =+ e=$(a l.a, b -.d)
409 =+ f=$(a r.a, b -.e)
413 =+ f=$(a r.a, b -.e)
410 [-.f [n.a +.e +.f]]
414 [-.f [n.a +.e +.f]]
415+ ::
411
416
412Replace values with accumulator
417Replace values with accumulator
413
418
@@ -419,23 +424,23 @@ XX interface changing, possibly disappearing
419
424
420Transform values
425Transform values
421
426
422− +- run :: turns to tuples
427+ +- run :: apply gate to values
423− |* b=_,*
428+ |* b/$-(* *)
424− |-
429+ |-
425 ?~ a a
430 ?~ a a
426− a(n (b q.n.a), l $(a l.a), r $(a r.a))
431+ [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
427
432
428Iterates over every value in set `a` using gate `b`. Produces a map.
433Iterates over every value in set `a` using gate `b`. Produces a map.
429
434
430−`a` is a [map]().
435+`a` is a map.
431
436
432−`b` is a [wet gate]().
437+`b` is a wet gate.
433
438
434 ~zod/try=> m
439 ~zod/try=> m
435 {[p='a' q=1] [p='b' q=2]}
440 {[p='a' q=1] [p='b' q=2]}
436 ~zod/try=> ^+(m (~(run by m) dec))
441 ~zod/try=> ^+(m (~(run by m) dec))
437 {[p='a' q=0] [p='b' q=1]}
442 {[p='a' q=0] [p='b' q=1]}
438− ~zod/try=> `(map ,@tas ,@t)`(~(run by m) (cury scot %ux))
443+ ~zod/try=> `(map @tas @t)`(~(run by m) (cury scot %ux))
439 {[p=%a q='0x1'] [p=%b q='0x2']}
444 {[p=%a q='0x1'] [p=%b q='0x2']}
440
445
441------------------------------------------------------------------------
446------------------------------------------------------------------------
@@ -446,18 +451,19 @@ Listify pairs
446
451
447 +- tap :: listify pairs
452 +- tap :: listify pairs
448 ~/ %tap
453 ~/ %tap
449− |= b=(list ,_?>(?=(^ a) n.a))
454+ |= b/(list _?>(?=(^ a) n.a))
450 ^+ b
455 ^+ b
451 ?~ a
456 ?~ a
452 b
457 b
453 $(a r.a, b [n.a $(a l.a)])
458 $(a r.a, b [n.a $(a l.a)])
459+ ::
454
460
455Produces the list of all elements in map `a` that is prepended to list
461Produces the list of all elements in map `a` that is prepended to list
456`b`, which is empty by default.
462`b`, which is empty by default.
457
463
458−`a` is a [map]().
464+`a` is a map.
459
465
460−`b` is a [list]().
466+`b` is a list.
461
467
462 {[p='a' q=1] [p='b' q=2]}
468 {[p='a' q=1] [p='b' q=2]}
463 ~zod/try=> `*`m
469 ~zod/try=> `*`m
@@ -475,7 +481,7 @@ Union
475
481
476 +- uni :: union, merge
482 +- uni :: union, merge
477 ~/ %uni
483 ~/ %uni
478− |* b=_a
484+ |* b/_a
479 |- ^+ a
485 |- ^+ a
480 ?~ b
486 ?~ b
481 a
487 a
@@ -484,21 +490,21 @@ Union
484 ?: (vor p.n.a p.n.b)
490 ?: (vor p.n.a p.n.b)
485 ?: =(p.n.b p.n.a)
491 ?: =(p.n.b p.n.a)
486 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
492 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
487− ?: (hor p.n.b p.n.a)
493+ ?: (gor p.n.b p.n.a)
488 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
494 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
489 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
495 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
490 ?: =(p.n.a p.n.b)
496 ?: =(p.n.a p.n.b)
491 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
497 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
492− ?: (hor p.n.a p.n.b)
498+ ?: (gor p.n.a p.n.b)
493 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
499 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
494 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
500 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
495
501
496Produces a map of the union between the keys of `a` and `b`. If `b`
502Produces a map of the union between the keys of `a` and `b`. If `b`
497shares a key with `a`, the tuple from `a` is preserved.
503shares a key with `a`, the tuple from `a` is preserved.
498
504
499−`a` is a [map]().
505+`a` is a map.
500
506
501−`b` is a [map]().
507+`b` is a map.
502
508
503 ~zod/try=> m
509 ~zod/try=> m
504 {[p='a' q=1] [p='b' q=2]}
510 {[p='a' q=1] [p='b' q=2]}
@@ -524,8 +530,8 @@ shares a key with `a`, the tuple from `a` is preserved.
524
530
525Turn (with key)
531Turn (with key)
526
532
527− +- urn :: turn
533+ +- urn :: apply gate to nodes
528− |* b=$+([* *] *)
534+ |* b/$-({* *} *)
529 |-
535 |-
530 ?~ a ~
536 ?~ a ~
531 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
537 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
@@ -533,9 +539,9 @@ Turn (with key)
533Iterates over every value in map `a` using gate `b`, which accepts both
539Iterates over every value in map `a` using gate `b`, which accepts both
534the key and the value of each element as its sample.
540the key and the value of each element as its sample.
535
541
536−`a` is a [map]().
542+`a` is a map.
537
543
538−`b` is a [wet gate]() that accepts two nouns (a key and a value) and
544+`b` is a wet gate that accepts two nouns (a key and a value) and
539produces a noun (the new value).
545produces a noun (the new value).
540
546
541 ~zod/try=> m
547 ~zod/try=> m
@@ -559,7 +565,7 @@ Depth
559
565
560Produce the depth of the tree map `a`.
566Produce the depth of the tree map `a`.
561
567
562−`a` is a [map]().
568+`a` is a map.
563
569
564 ~zod/try=> m
570 ~zod/try=> m
565 {[p='a' q=1] [p='b' q=2]}
571 {[p='a' q=1] [p='b' q=2]}
docs/system/hoon/library/src/2j/core/ja.md+11−166
@@ -2,13 +2,12 @@
2
2
3Jar engine
3Jar engine
4
4
5− ++ ja :: jar engine
6− |/ a=(jar)
5+ |_ a/(jar)
7
6
8A container arm for `++jar` operation arms. A `++jar` is a `++map` of
7A container arm for `++jar` operation arms. A `++jar` is a `++map` of
9−`++list`s. The contained arms inherit the [sample]() jar.
8+`++list`s. The contained arms inherit the sample jar.
10
9
11−`a` is a [jar]().
10+`a` is a jar.
12
11
13 ~zod/try=> ~(. ja (mo (limo a/"ho" b/"he" ~)))
12 ~zod/try=> ~(. ja (mo (limo a/"ho" b/"he" ~)))
14 <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
13 <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
@@ -19,14 +18,15 @@ A container arm for `++jar` operation arms. A `++jar` is a `++map` of
19
18
20Grab value by key
19Grab value by key
21
20
22− +- get :: grab value by key
21+ +- get :: gets list by key
23− |* b=*
22+ |* b/*
24 =+ c=(~(get by a) b)
23 =+ c=(~(get by a) b)
25 ?~(c ~ u.c)
24 ?~(c ~ u.c)
25+ ::
26
26
27Produces a list retrieved from jar `a` using the key `b`.
27Produces a list retrieved from jar `a` using the key `b`.
28
28
29−`a` is a [`++jar`](/doc/hoon/library/1#++jar).
29+`a` is a `++jar`.
30
30
31`b` is a key of the same type as the keys in `a`.
31`b` is a key of the same type as the keys in `a`.
32
32
@@ -47,14 +47,14 @@ Produces a list retrieved from jar `a` using the key `b`.
47Prepend to list
47Prepend to list
48
48
49 +- add :: adds key-list pair
49 +- add :: adds key-list pair
50− |* [b=* c=*]
50+ |* {b/* c/*}
51− =+ d=(get(+< a) b)
51+ =+ d=(get b)
52 (~(put by a) b [c d])
52 (~(put by a) b [c d])
53
53
54Produces jar `a` with value `c` prepended to the list located at key
54Produces jar `a` with value `c` prepended to the list located at key
55`b`.
55`b`.
56
56
57−`a` is a [jar]().
57+`a` is a jar.
58
58
59`b` is a key of the same type as the keys in `a`.
59`b` is a key of the same type as the keys in `a`.
60
60
@@ -73,159 +73,4 @@ Produces jar `a` with value `c` prepended to the list located at key
73 ! type-fail
73 ! type-fail
74 ! exit
74 ! exit
75
75
76−------------------------------------------------------------------------
76+**
77−
78−### `++ju`
79−
80−Jug operations
81−
82− ++ ju :: jug engine
83− |/ a=(jug)
84−
85−Container arm for jug operation arms. A `++jug` is a `++map` of
86−`++sets`. The contained arms inherit its [sample]() jug, `a`.
87−
88−`a` is a [jug]().
89−
90− ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
91− <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
92−
93−### `+-del:ju`
94−
95−Remove
96−
97− +- del :: delete at key b
98− |* [b=* c=*]
99− ^+ a
100− =+ d=(get(+< a) b)
101− =+ e=(~(del in d) c)
102− ?~ e
103− (~(del by a) b)
104− (~(put by a) b e)
105−
106−Produces jug `a` with value `c` removed from set located at key `b`.
107−
108−`a` is a [jug]().
109−
110−`b` is a key of the same type as the keys in `a`.
111−
112−`c` is the value of the same type of the keys in `a` that is to be
113−removed.
114−
115− ~zod/try=> s
116− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
117− ~zod/try=> (~(del ju s) 'a' 1)
118− {[p='a' q={3 2}] [p='b' q={5 4 6}]}
119− ~zod/try=> (~(del ju s) 'c' 7)
120− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
121−
122−------------------------------------------------------------------------
123−
124−### `+-get:ju`
125−
126−Retrieve set
127−
128− +- get :: gets set by key
129− |* b=*
130− =+ c=(~(get by a) b)
131− ?~(c ~ u.c)
132−
133−Produces a set retrieved from jar `a` using key `b`.
134−
135−`a` is a [jar]().
136−
137−`b` is a key of the same type as the keys in `a`.
138−
139− ~zod/try=> s
140− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
141− ~zod/try=> (~(get ju s) 'a')
142− {1 3 2}
143− ~zod/try=> (~(get ju s) 'b')
144− {5 4 6}
145− ~zod/try=> (~(get ju s) 'c')
146− ~
147−
148−------------------------------------------------------------------------
149−
150−### `+-has:ju`
151−
152−Check contents
153−
154− +- has :: existence check
155− |* [b=* c=*]
156− ^- ?
157− (~(has in (get(+< a) b)) c)
158−
159−Computes whether a value `c` exists within the set located at key `b`
160−with jar `a`. Produces a loobean.
161−
162−`a` is a [set]().
163−
164−`b` is a key as a [noun]().
165−
166−`c` is a value as a [noun]().
167−
168− ~zod/try=> s
169− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
170− ~zod/try=> (~(has ju s) 'a' 3)
171− %.y
172− ~zod/try=> (~(has ju s) 'b' 6)
173− %.y
174− ~zod/try=> (~(has ju s) 'a' 7)
175− %.n
176− ~zod/try=> (~(has jus s) 'c' 7)
177− ! -find-limb.jus
178− ! find-none
179− ! exit
180− ~zod/try=> (~(has ju s) 'c' 7)
181− %.n
182−
183−------------------------------------------------------------------------
184−
185−### `+-put:ju`
186−
187−Add key-set pair
188−
189− +- put :: adds key-element pair
190− |* [b=* c=*]
191− ^+ a
192− =+ d=(get(+< a) b)
193− (~(put by a) b (~(put in d) c))
194−
195−Produces jar `a` with `c` added to the set value located at key `b`.
196−
197−`a` is a [set]().
198−
199−`b` is a key as a [noun]().
200−
201−`c` is a [value]().
202−
203− ~zod/try=> s
204− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
205− ~zod/try=> (~(put ju s) 'a' 7)
206− {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
207− ~zod/try=> (~(put ju s) 'a' 1)
208− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
209− ~zod/try=> (~(put ju s) 'c' 7)
210− {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
211−
212−------------------------------------------------------------------------
213−
214−### `++by`
215−
216−Map operations
217−
218− ++ by :: map engine
219− ~/ %by
220− |/ a=(map)
221−
222−Container arm for map operation arms. A map is a set of key, value
223−pairs. The contained arms inherit it's [sample]() [map](), `a`.
224−
225−`a` is a [map]().
226−
227− ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
228− <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
229−
230−
231−***
docs/system/hoon/library/src/2j/core/ju.md+25−20
@@ -3,12 +3,12 @@
3Jug operations
3Jug operations
4
4
5 ++ ju :: jug engine
5 ++ ju :: jug engine
6− |/ a=(jug)
6+ |/ a/(jug)
7
7
8Container arm for jug operation arms. A `++jug` is a `++map` of
8Container arm for jug operation arms. A `++jug` is a `++map` of
9−`++sets`. The contained arms inherit its [sample]() jug, `a`.
9+`++sets`. The contained arms inherit its sample jug, `a`.
10
10
11−`a` is a [jug]().
11+`a` is a jug.
12
12
13 ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
13 ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
14 <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
14 <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
@@ -17,18 +17,20 @@ Container arm for jug operation arms. A `++jug` is a `++map` of
17
17
18Remove
18Remove
19
19
20− +- del :: delete at key b
20+ +- del :: del key-set pair
21− |* [b=* c=*]
21+ |* {b/* c/*}
22 ^+ a
22 ^+ a
23− =+ d=(get(+< a) b)
23+ =+ d=(get b)
24 =+ e=(~(del in d) c)
24 =+ e=(~(del in d) c)
25 ?~ e
25 ?~ e
26 (~(del by a) b)
26 (~(del by a) b)
27 (~(put by a) b e)
27 (~(put by a) b e)
28+ ::
29+
28
30
29Produces jug `a` with value `c` removed from set located at key `b`.
31Produces jug `a` with value `c` removed from set located at key `b`.
30
32
31−`a` is a [jug]().
33+`a` is a jug.
32
34
33`b` is a key of the same type as the keys in `a`.
35`b` is a key of the same type as the keys in `a`.
34
36
@@ -49,13 +51,14 @@ removed.
49Retrieve set
51Retrieve set
50
52
51 +- get :: gets set by key
53 +- get :: gets set by key
52− |* b=*
54+ |* b/*
53 =+ c=(~(get by a) b)
55 =+ c=(~(get by a) b)
54 ?~(c ~ u.c)
56 ?~(c ~ u.c)
57+ ::
55
58
56Produces a set retrieved from jar `a` using key `b`.
59Produces a set retrieved from jar `a` using key `b`.
57
60
58−`a` is a [jar]().
61+`a` is a jar.
59
62
60`b` is a key of the same type as the keys in `a`.
63`b` is a key of the same type as the keys in `a`.
61
64
@@ -75,18 +78,20 @@ Produces a set retrieved from jar `a` using key `b`.
75Check contents
78Check contents
76
79
77 +- has :: existence check
80 +- has :: existence check
78− |* [b=* c=*]
81+ |* {b/* c/*}
79 ^- ?
82 ^- ?
80− (~(has in (get(+< a) b)) c)
83+ (~(has in (get b)) c)
84+ ::
85+
81
86
82Computes whether a value `c` exists within the set located at key `b`
87Computes whether a value `c` exists within the set located at key `b`
83with jar `a`. Produces a loobean.
88with jar `a`. Produces a loobean.
84
89
85−`a` is a [set]().
90+`a` is a set.
86
91
87−`b` is a key as a [noun]().
92+`b` is a key as a noun.
88
93
89−`c` is a value as a [noun]().
94+`c` is a value as a noun.
90
95
91 ~zod/try=> s
96 ~zod/try=> s
92 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
97 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
@@ -109,19 +114,19 @@ with jar `a`. Produces a loobean.
109
114
110Add key-set pair
115Add key-set pair
111
116
112− +- put :: adds key-element pair
117+ +- put :: add key-set pair
113− |* [b=* c=*]
118+ |* {b/* c/*}
114 ^+ a
119 ^+ a
115− =+ d=(get(+< a) b)
120+ =+ d=(get b)
116 (~(put by a) b (~(put in d) c))
121 (~(put by a) b (~(put in d) c))
117
122
118Produces jar `a` with `c` added to the set value located at key `b`.
123Produces jar `a` with `c` added to the set value located at key `b`.
119
124
120−`a` is a [set]().
125+`a` is a set.
121
126
122−`b` is a key as a [noun]().
127+`b` is a key as a noun.
123
128
124−`c` is a [value]().
129+`c` is a value.
125
130
126 ~zod/try=> s
131 ~zod/try=> s
127 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
132 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}