on f3ca521 help sign in
1293 lines 20 kB history raw
1+++
2title = "2b: List Logic"
3weight = 5
4template = "doc.html"
5aliases = ["/docs/reference/library/2b"]
6+++
7### `++fand`
9All indices in `list`
11Produces the indices of all occurrences of `nedl` in `hstk` as a `list` of
12atoms.
14#### Accepts
16`nedl` is a list.
18`hstk` is a list.
20#### Produces
22A `list`.
24#### Source
26```hoon
27 ++ fand
28 ~/ %fand
29 |= [nedl=(list) hstk=(list)]
30 =| i=@ud
31 =| fnd=(list @ud)
32 |- ^+ fnd
33 =+ [n=nedl h=hstk]
34 |-
35 ?: |(?=($~ n) ?=($~ h))
36 (flop fnd)
37 ?: =(i.n i.h)
38 ?~ t.n
39 ^$(i +(i), hstk +.hstk, fnd [i fnd])
40 $(n t.n, h t.h)
41 ^$(i +(i), hstk +.hstk)
42```
44#### Examples
46```
47 > (fand ~[3] ~[1 2 3])
48 ~[2]
50 > (fand ~[4] ~[1 2 3])
51 ~
53 > (fand ~['a'] "cbabab")
54 ~[2 4]
56 > (fand "ba" "cbabab")
57 ~[1 3]
58```
61---
62### `++find`
64First index in `list`
66Produces the index of the first occurrence of `nedl` in `hstk` as the `unit`
67of an atom.
69#### Accepts
71`nedl` is a list.
73`hstk` is a list.
75#### Produces
77The `unit` of an atom.
79#### Source
81```hoon
82 ++ find
83 ~/ %find
84 |= [nedl=(list) hstk=(list)]
85 =| i=@ud
86 |- ^- (unit @ud)
87 =+ [n=nedl h=hstk]
88 |-
89 ?: |(?=($~ n) ?=($~ h))
90 ~
91 ?: =(i.n i.h)
92 ?~ t.n
93 `i
94 $(n t.n, h t.h)
95 ^$(i +(i), hstk +.hstk)
96```
98#### Examples
100```
101 > (find [3]~ ~[1 2 3])
102 [~ u=2]
104 > (find [4]~ ~[1 2 3])
105 ~
107 > (find ['c']~ "cbabab")
108 [~ u=0]
110 > (find "ab" "cbabab")
111 [~ u=1]
113 > (find "bab" "cbabab")
114 [~ u=2]
115```
117---
118### `++flop`
120Reverse
122Produces the `list` `a` in reverse order.
124#### Accepts
126`a` is a `list`.
128#### Produces
130A `list`.
132#### Source
134```hoon
135 ++ flop
136 ~/ %flop
137 |* a=(list)
138 => .(a (homo a))
139 ^+ a
140 =+ b=`_a`~
141 |-
142 ?~ a b
143 $(a t.a, b [i.a b])
144```
147#### Examples
149```
150 > =a [1 2 3 ~]
151 > (flop a)
152 ~[3 2 1]
154 > (flop (flop a))
155 ~[1 2 3]
156```
158---
159### `++gulf`
161List from range
163Produces a `list` composed of each consecutive integer starting from `a` and
164ending with `b`. `a` and `b` are themselves included.
166#### Accepts
168`a` is an atom.
170`b` is an atom.
172#### Produces
174a `list`.
176#### Source
178```hoon
179 ++ gulf
180 |= [a=@ b=@]
181 ^- (list @)
182 ?:(=(a +(b)) ~ [a $(a +(a))])
183```
185#### Examples
187```
188 > (gulf 1 6)
189 ~[1 2 3 4 5 6]
191 > `(list @t)`(gulf 99 106)
192 <|c d e f g h i j|>
193```
195---
196### `++homo`
198Homogenize
200Produces a `list` whose type is a fork of all the contained types in the
201list `a`. Used when you want to make all the types of the elements of a list the
202same.
204#### Accepts
206`a` is a `list`.
208#### Produces
210a `list`.
212#### Source
214```hoon
215 ++ homo
216 |* a=(list)
217 ^+ =< $
218 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
219 --
220 a
221```
223#### Examples
225```
226 > lyst
227 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
229 > (homo lyst)
230 ~[1 97 2 98 [~ u=10]]
232 > =a (limo [1 2 3 ~])
233 > a
234 [i=1 t=[i=2 t=[i=3 t=~]]]
236 > (homo a)
237 ~[1 2 3]
238```
240---
242### `++join`
244Constructs a new `list`, placing `sep` between every element of `lit`.
246#### Accepts
248`sep` is a `noun`.
250`lit` is a `list`.
252#### Produces
254a `list`.
256#### Source
258```hoon
259 ++ join
260 |* [sep=* lit=(list)]
261 =. sep `_?>(?=(^ lit) i.lit)`sep
262 ?~ lit ~
263 =| out=(list _?>(?=(^ lit) i.lit))
264 |- ^+ out
265 ?~ t.lit
266 (flop [i.lit out])
267 $(out [sep i.lit out], lit t.lit)
268```
270#### Examples
272```
273 > (join ' ' "hoon")
274 "h o o n"
276 > (join 0 `(list @)`~[1 2 3])
277 ~[1 0 2 0 3]
278```
280---
281### `++lent`
283List length
285Produces the length of any `list` `a` as an atom.
287#### Accepts
289`a` is a `list`.
291#### Produces
293an atom.
295#### Source
297```hoon
298 ++ lent
299 ~/ %lent
300 |= a=(list)
301 ^- @
302 =+ b=0
303 |-
304 ?~ a b
305 $(a t.a, b +(b))
306```
308#### Examples
310```
311 > (lent [1 2 3 4 ~]))
312 4
314 > (lent [1 'a' 2 'b' (some 10) ~])
315 5
316```
319---
320### `++levy`
322Logical "and" on list
324Computes the Boolean logical "and" on the results of gate `b` applied to each individual element in `list` `a`.
326#### Accepts
328`a` is a list.
330`b` is a gate.
332#### Produces
334A boolean.
336#### Source
338```hoon
339 ++ levy
340 ~/ %levy :: all of
341 |* [a=(list) b=$-(* ?)]
342 |- ^- ?
343 ?~ a &
344 ?. (b i.a) |
345 $(a t.a)
346```
348#### Examples
350```
351 > =a |=(a=@ (lte a 1))
352 > (levy `(list @)`[0 1 2 1 ~] a)
353 %.n
355 > =a |=(a=@ (lte a 3))
356 > (levy `(list @)`[0 1 2 1 ~] a)
357 %.y
358```
361---
363### `++lien`
365Logical "or" on list
367Computes the Boolean logical "or" on the results of applying `gate` `b` to
368every element of `++list` `a`.
370#### Accepts
372`a` is a list.
374`b` is a gate.
376#### Source
378```hoon
379 ++ lien
380 ~/ %lien
381 |* [a=(list) b=$-(* ?)]
382 |- ^- ?
383 ?~ a |
384 ?: (b i.a) &
385 $(a t.a)
386```
388#### Examples
390```
391 > =a |=(a=@ (gte a 1))
392 > (lien `(list @)`[0 1 2 1 ~] a)
393 %.y
395 > =a |=(a=@ (gte a 3))
396 > (lien `(list @)`[0 1 2 1 ~]) a)
397 %.n
398```
401---
402### `++limo`
404List Constructor
406Turns a null-terminated tuple into a `list`.
408#### Accepts
410`a` is a null-terminated tuple.
412#### Produces
414A `++list`.
416#### Source
418```hoon
419 ++ limo :: listify
420 |* a=*
421 ^+ =< $
422 |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
423 --
424 a
425```
427#### Examples
429```
430 > (limo [1 2 3 ~])
431 [i=1 t=[i=2 t=[i=3 t=~]]]
432```
435---
436### `++murn`
438Maybe transform
440Passes each member of `list` `a` to gate `b`, which must produce a
441`unit`. Produces a new list with all the results that do not produce
442`~`.
444#### Accepts
446`a` is a list.
448`b` is a gate that produces a unit.
450#### Produces
452A unit.
454#### Source
456```hoon
457 ++ murn :: maybe transform
458 ~/ %murn
459 |* [a=(list) b=$-(* (unit))]
460 |-
461 ?~ a ~
462 =+ c=(b i.a)
463 ?~ c
464 $(a t.a)
465 [i=u.c t=$(a t.a)]
466```
468#### Examples
470```
471 > =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
472 > (murn `(list @)`[0 1 2 3 ~] a)
473 [i=12 t=[i=13 t=~]]
474```
477---
478### `++oust`
480Remove
482Removes elements from list `c` beginning at inclusive index `a`, removing `b`
483number of elements.
485#### Accepts
487`c` is a list.
489#### Produces
491A `++list`.
493#### Source
495```hoon
496 ++ oust :: remove
497 ~/ %oust
498 |* [[a=@ b=@] c=(list)]
499 (weld (scag a c) (slag (add a b) c))
500```
502#### Examples
504```
505 > (oust [4 5] "good day, urbit!")
506 "good urbit!"
508 > (oust [2 2] `(list @)`[1 2 3 4 ~])
509 ~[1 2]
510```
513---
514### `++reap`
516Replicate
518Replicate: produces a `list` containing `a` copies of `b`.
520#### Accepts
522`a` is an atom.
524`b` is a noun.
526#### Produces
528A list.
530#### Source
532```hoon
533 ++ reap :: replicate
534 ~/ %reap
535 |* [a=@ b=*]
536 |- ^- (list _b)
537 ?~ a ~
538 [b $(a (dec a))]
539```
541#### Examples
543```
544 > (reap 20 %a)
545 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
547 > (reap 5 ~s1)
548 ~[~s1 ~s1 ~s1 ~s1 ~s1]
550 > `@dr`(roll (reap 5 ~s1) add)
551 ~s5
552```
555---
556### `++reel`
558Right fold
560Right fold: moves right to left across a `list` `a`, recursively slamming
561a binary gate `b` with an element from `a` and an accumulator, producing
562the final value of the accumulator.
564(To "slam" means to call a gate and give it a sample/samples. In this instance,
565`a` is the list of samples that are given to the gate b.)
567#### Accepts
569`a` is a list.
571`b` is a binary gate.
573#### Produces
575The accumulator, which is a noun.
577#### Source
579```hoon
580 ++ reel
581 ~/ %reel
582 |* [a=(list) b=_|=([* *] +<+)]
583 |- ^+ +<+.b
584 ?~ a
585 +<+.b
586 (b i.a $(a t.a))
587```
589#### Examples
591```
592 > =sum =|([p=@ q=@] |.((add p q)))
593 > (reel (limo [1 2 3 4 5 ~]) sum)
594 15
596 > =a =|([p=@ q=@] |.((sub p q)))
597 > (reel (limo [6 3 1 ~]) a)
598 4
600 > (reel (limo [3 6 1 ~]) a)
601 ! subtract-underflow
602 ! exit
603```
606---
607### `++roll`
609Left fold
611Left fold: moves left to right across a list `a`, recursively slamming a
612binary gate `b` with an element from the `list` and an accumulator,
613producing the final value of the accumulator.
615(To "slam" means to call a gate and give it a sample/samples. In this instance,
616`a` is the list of samples that are given to the gate b.)
618#### Accepts
620`a` is a list.
622`b` is a binary gate.
624#### Produces
626The accumulator, which is a noun.
628#### Source
630```hoon
631 ++ roll :: left fold
632 ~/ %roll
633 |* [a=(list) b=_|=([* *] +<+)]
634 |- ^+ +<+.b
635 ?~ a
636 +<+.b
637 $(a t.a, b b(+<+ (b i.a +<+.b)))
638```
640#### Examples
642```
643 > =sum =|([p=@ q=@] |.((add p q)))
644 > (roll (limo [1 2 3 4 5 ~]) sum)
645 q=15
647 > =a =|([p=@ q=@] |.((sub p q)))
648 > (roll (limo [6 3 1 ~]) a)
649 ! subtract-underflow
650 ! exit
652 > (roll (limo [1 3 6 ~]) a)
653 q=4
654```
657---
658### `++scag`
660Prefix
662Accepts an atom `a` and `list` `b`, producing the first `a` elements of
663the front of the list.
665#### Accepts
667`a` is an atom.
669`b` is a list.
671#### Produces
673A list of the same type as `b`.
675#### Source
677```hoon
678 ++ scag :: prefix
679 ~/ %scag
680 |* [a=@ b=(list)]
681 |- ^+ b
682 ?: |(?=(~ b) =(0 a)) ~
683 [i.b $(b t.b, a (dec a))]
684```
686#### Examples
688```
689 > (scag 2 `(list @)`[1 2 3 4 ~])
690 [i=1 t=~[2]]
692 > (scag 10 `(list @)`[1 2 3 4 ~])
693 [i=1 t=~[2 3 4]]
694```
697---
698### `++skid`
700Separate
702Separates a `list` `a` into two lists - Those elements of `a` who produce
703true when slammed to gate `b` and those who produce `%.n`.
705(To "slam" means to call a gate and give it a sample/samples. In this instance,
706`a` is the list of samples that are given to the gate `b`.)
708#### Accepts
710`a` is a list.
712`b` is a gate that accepts one argument and produces a flag.
714#### Produces
716A cell of two lists.
718#### Source
720```hoon
721 ++ skid :: separate
722 ~/ %skid
723 |* [a=(list) b=$-(* ?)]
724 |- ^+ [p=a q=a]
725 ?~ a [~ ~]
726 =+ c=$(a t.a)
727 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
728```
731#### Examples
733```
734 > =a |=(a=@ (gth a 1))
735 > (skid `(list @)`[0 1 2 3 ~]) a)
736 (skid `(list @)`[0 1 2 3 ~]) a)
737```
740---
741### `++skim`
743Suffix
745Cycles through the members of a list `a`, passing them to a gate `b` and
746producing a list of all of the members that produce `%.y`. Inverse of
747`skip`.
749#### Accepts
751`a` is a list.
753`b` is a gate that accepts one argument and produces a boolean.
755#### Produces
757A flag.
759#### Source
761```hoon
762 ++ skim :: only
763 ~/ %skim
764 |* [a=(list) b=$-(* ?)]
765 |-
766 ^+ a
767 ?~ a ~
768 ?:((b i.a) [i.a $(a t.a)] $(a t.a))
769```
771#### Examples
773```
774 > =a |=(a=@ (gth a 1))
775 > (skim `(list @)`[0 1 2 3 ~] a)
776 [i=2 t=~[3]]
777```
779---
780### `++skip`
782Except
784Cycles through the members of `list` `a`, passing them to a gate `b`.
785Produces a list of all of the members that produce `%.n`. Inverse of
786`skim`.
788#### Accepts
790`a` is a list.
792`b` is a gate that accepts one argument and produces a flag.
794#### Produces
796A list of the same type as `a`.
798#### Source
800```hoon
801 ++ skip :: except
802 ~/ %skip
803 |* [a=(list) b=$-(* ?)]
804 |-
805 ^+ a
806 ?~ a ~
807 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
808```
810#### Examples
812```
813 > =a |=(a=@ (gth a 1))
814 > (skip `(l)`[0 1 2 3 ~]) a)
815 [i=0 t=[i=1 t=~]]
816```
819---
820### `++slag`
822Suffix
824Accepts an atom `a` and list `b`, producing the remaining elements from
825`b` starting at `a`.
827#### Accepts
829`a` is an atom.
831`b` is a list.
833#### Produces
835A list of the same type as `b`.
837#### Source
839```hoon
840 ++ slag :: suffix
841 ~/ %slag
842 |* [a=@ b=(list)]
843 |- ^+ b
844 ?: =(0 a) b
845 ?~ b ~
846 $(b t.b, a (dec a))
847```
849#### Examples
851```
852 > (slag 2 (limo [1 2 3 4 ~]))
853 [i=3 t=[i=4 t=~]]
854 > (slag 1 (limo [1 2 3 4 ~]))
855 [i=2 t=[i=3 t=[i=4 t=~]]]
856```
859---
860### `++snag`
862Index
864Accepts an atom `a` and a `++list` `b`, producing the element at the index
865of `a`and failing if the list is null. Lists are 0-indexed.
867#### Accepts
869`a` is an atom.
871`b` is a list.
873#### Produces
875Produces an element of `b`, or crashes if no element exists at that index.
877#### Source
879```hoon
880 ++ snag :: index
881 ~/ %snag
882 |* [a=@ b=(list)]
883 |-
884 ?~ b
885 ~|('snag-fail' !!)
886 ?: =(0 a) i.b
887 $(b t.b, a (dec a))
888```
890#### Examples
892```
893 > (snag 2 "asdf")
894 ~~d
895 > (snag 0 `(list @ud)`~[1 2 3 4])
896 1
897```
900---
901### `++snoc`
903Append
905Accepts a `++list` `a` and a noun `b`, producing the list of `b` appended to `a`.
907#### Accepts
909`a` is a list.
911`b` is a noun.
913#### Produces
915Produces a list of `b` appended to `a`.
917#### Source
919```hoon
920 ++ snoc
921 |* [a/(list) b/*]
922 (weld a ^+(a [b]~))
923```
925#### Examples
927```
928 > `tape`(zing (snoc `(list tape)`~["a" "bc" "def"] "g"))
929 "abcdefg"
930 > (snoc `(list @ud)`~[1 2 3] 4)
931 ~[1 2 3 4]
932```
935---
936### `++sort`
938Quicksort
940Quicksort: accepts a `++list` `a` and a gate `b` which accepts two nouns and
941produces a flag. `++sort` then produces a list of the elements of `a`,
942sorted according to `b`.
944#### Accepts
946`a` is a list.
948`b` is a gate that accepts two nouns and produces a boolean.
950#### Produces
952A list
954#### Source
956```hoon
957 ++ sort !. :: quicksort
958 ~/ %sort
959 |* [a=(list) b=$-([* *] ?)]
960 => .(a ^.(homo a))
961 |- ^+ a
962 ?~ a ~
963 %+ weld
964 $(a (skim t.a |=(c/_i.a (b c i.a))))
965 ^+ t.a
966 [i.a $(a (skim t.a |=(c/_i.a !(b c i.a))))]
967```
969#### Examples
971```
972 > =a =|([p/@ q/@] |.((gth p q)))
973 > (sort (limo [0 1 2 3 ~]) a)
974 ~[3 2 1 0]
975```
978---
979### `++spin`
981Gate to list, with state
983Accepts a `++list` `a`, a gate `b`, and some state `c`. Produces a list with
984the gate applied to each element of the original list. `b` is called with
985a tuple -- the head is an element of `a` and the tail is the state `c`, and
986should produce a tuple of the transformed element and the (potentially
987modified) state `c`.
989#### Accepts
991`a` is a `++list`.
993`b` is a gate.
995`c` is a noun.
997#### Produces
999A list.
1001#### Source
1003```hoon
1004 ++ spin
1005 ~/ %spin
1006 |* [a=(list) b=* c=_|=(^ [** +<+])]
1007 => .(c `$-([_?>(?=(^ a) i.a) _b] [_-:(c) _b])`c)
1008 =/ acc=(list _-:(c)) ~
1009 |- ^- (pair _acc _b)
1010 ?~ a
1011 [(flop acc) b]
1012 =^ res b (c i.a b)
1013 $(acc [res acc], a t.a)
1014```
1016#### Examples
1018```
1019 > %^ spin (limo ~[4 5 6]) :: trivial example -- does nothing with the state
1020 |=([n=@ a=@] [n a])
1022 ~[4 5 6]
1024 > %^ spin (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
1025 |=([n=@ a=@] [`(pair)`[a n] +(a)])
1027 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
1029 > %^ spin (reap 10 0) :: Create 10 random numbers less than `10`
1030 |=([n=@ rng=_og] (rads:rng 10))
1031 ~(. og eny)
1032 ~[5 5 9 4 1 7 9 9 9 6]
1033```
1035#### Discussion
1037`(~(rads og eny) 2)` creates a random number less than `2`, seeding the RNG
1038with entropy (`eny`). The head of the product is the random number, the tail
1039is the continuation of the RNG.
1043---
1044### `++spun`
1046Gate to list, with state
1048Accepts a `list` `a` and a gate `b`. `c` is internal state, initially
1049derived by **bunting** the tail of the sample of gate `b`, instead of
1050being passed in explicitly as in `++spin`. Produces a list with the
1051gate applied to each element of the original list. `b` is called with a tuple --
1052the head is an element of `a` and the tail is the state `c`, and should
1053produce a tuple of the transformed element and the (potentially modified)
1054state `c`.
1056#### Accepts
1058`a` is a `++list`.
1060`b` is a gate.
1062#### Produces
1064A list.
1066#### Source
1068```hoon
1069 ++ spun
1070 ~/ %spun
1071 |* [a=(list) b=_|=(^ [** +<+])]
1072 p:(spin a +<+.b b)
1073```
1075#### Examples
1077```
1078 > %+ spun (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
1079 |=([n=@ a=@] [`(pair)`[a n] +(a)])
1080 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
1082 > =l (limo ~[7 8 9])
1083 > %+ spun (limo ~[4 5 6]) :: joins two lists into a list of pairs
1084 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
1085 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
1086```
1089---
1090### `++swag`
1092Infix
1094Similar to `substr` in Javascript: extracts a string infix, beginning at
1095inclusive index `a`, producing `b` number of characters.
1097#### Accepts
1099`a` is an atom.
1101`b` is an atom.
1103`c` is a list.
1105#### Produces
1107A list of the same type as `c`.
1109#### Source
1111```hoon
1112 ++ swag
1113 |* [[a=@ b=@] c=(list)]
1114 (scag +<-> (slag +<-< c))
1115```
1117#### Examples
1119```
1120 > (swag [2 5] "roly poly")
1121 "ly po"
1123 > (swag [2 2] (limo [1 2 3 4 ~]))
1124 [i=3 t=[i=4 t=~]]
1125```
1128---
1129### `++turn`
1131Gate to list
1133Accepts a `++list` `a` and a gate `b`. Produces a list with the gate applied
1134to each element of the original list.
1136#### Accepts
1138`a` is a list.
1140`b` is a gate.
1142#### Produces
1144A list.
1146#### Source
1148```hoon
1149 ++ turn
1150 ~/ %turn
1151 |* [a=(list) b=gate]
1152 |-
1153 ?~ a ~
1154 [i=(b i.a) t=$(a t.a)]
1155```
1157#### Examples
1159```
1160 > (turn (limo [104 111 111 110 ~]) @t)
1161 <|h o o n|>
1163 > =a |=(a=@ (add a 4))
1164 > (turn (limo [1 2 3 4 ~]) a)
1165 ~[5 6 7 8]
1166```
1168#### Discussion
1170`turn` is Hoon's version of 'map' in Haskell.
1172---
1173### `++weld`
1175Concatenate
1177Concatenate two `++list`s `a` and `b`.
1179#### Accepts
1181`a` and `b` are lists.
1183#### Source
1185```hoon
1186 ++ weld
1187 ~/ %weld
1188 |* [a=(list) b=(list)]
1189 => .(a ^.(homo a), b ^.(homo b))
1190 |- ^+ b
1191 ?~ a b
1192 [i.a $(a t.a)]
1193```
1195#### Examples
1197```
1198 > (weld "urb" "it")
1199 ~[~~u ~~r ~~b ~~i ~~t]
1201 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
1202 ~[1 2 3 4]
1203```
1206---
1207### `++welp`
1209Perfect weld
1211Concatenate two `++list`s `a` and `b` without losing their type information
1212to homogenization.
1214#### Accepts
1216`a` is a list.
1218`b` is a list.
1220#### Produces
1222A list.
1224#### Source
1226```hoon
1227 ++ welp
1228 =| [* *]
1229 |%
1230 +- $
1231 ?~ +<-
1232 +<-(. +<+)
1233 +<-(+ $(+<- +<->))
1234 --
1235```
1237#### Examples
1239```
1240 > (welp "foo" "bar")
1241 "foobar"
1243 > (welp ~[60 61 62] ~[%a %b %c])
1244 [60 61 62 %a %b %c ~]
1246 > ? (welp ~[60 61 62] ~[%a %b %c])
1247 {@ud @ud @ud $a $b $c $~}
1248 [60 61 62 %a %b %c ~]
1250 > (welp [sa+1 so+2 ~] si=3)
1251 [[%sa 1] [%so 2] si=3]
1252```
1255---
1256### `++zing`
1258Turns a `++list` of lists into a single list by promoting the elements of
1259each sublist into the higher.
1261#### Accepts
1263A list of lists.
1265#### Produces
1267A list.
1269#### Source
1271```hoon
1272 ++ zing
1273 =| *
1274 |%
1275 +- $
1276 ?~ +<
1277 +<
1278 (welp +<- $(+< +<+))
1279 --
1280```
1283#### Examples
1285```
1286 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1287 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1289 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1290 ~[1 97 2 98 3 99 4 100]
1291```
1293---