@@ -8,8 +8,8 @@ navhome: /docs/
9All indices in `list`
9All indices in `list`
11−Produces the indices of all occurrences of `list` `nedl` in
11+Produces the indices of all occurrences of `nedl` in `hstk` as a `list` of
12−`list` `hstk` as a `list` of atoms.
12+atoms.
14#### Accepts
14#### Accepts
@@ -23,7 +23,7 @@ A `list`.
24#### Source
24#### Source
26− ++ fand :: all indices
26+ ++ fand
28 |= [nedl=(list) hstk=(list)]
28 |= [nedl=(list) hstk=(list)]
@@ -42,13 +42,13 @@ A `list`.
43#### Examples
43#### Examples
45− > (fand [3]~ ~[1 2 3])
45+ > (fand ~[3] ~[1 2 3])
48− > (fand [4]~ ~[1 2 3])
48+ > (fand ~[4] ~[1 2 3])
51− > (fand ['a']~ "cbabab")
51+ > (fand ~['a'] "cbabab")
54 > (fand "ba" "cbabab")
54 > (fand "ba" "cbabab")
@@ -61,8 +61,8 @@ A `list`.
62First index in `list`
62First index in `list`
64−Produces the index of the first occurrence of `list` `nedl` in
64+Produces the index of the first occurrence of `nedl` in `hstk` as the `unit`
65−`list` `hstk` as the `unit` of an atom.
65+of an atom.
67#### Accepts
67#### Accepts
@@ -76,7 +76,7 @@ The `unit` of an atom.
77#### Source
77#### Source
79− ++ find :: first index
79+ ++ find
81 |= [nedl=(list) hstk=(list)]
81 |= [nedl=(list) hstk=(list)]
@@ -127,7 +127,7 @@ A `list`.
128#### Source
128#### Source
130− ++ flop :: reverse
130+ ++ flop
132 |* a=(list)
132 |* a=(list)
133 => .(a (homo a))
133 => .(a (homo a))
@@ -168,7 +168,7 @@ a `list`.
169#### Source
169#### Source
171− ++ gulf :: range inclusive
171+ ++ gulf
172 |= [a=@ b=@]
172 |= [a=@ b=@]
173 ^- (list @)
173 ^- (list @)
174 ?:(=(a +(b)) ~ [a $(a +(a))])
174 ?:(=(a +(b)) ~ [a $(a +(a))])
@@ -187,7 +187,8 @@ a `list`.
187Homogenize
187Homogenize
189Produces a `list` whose type is a fork of all the contained types in the
189Produces a `list` whose type is a fork of all the contained types in the
190−list `a`. Used when you want to make all the types of the elements of a list the same.
190+list `a`. Used when you want to make all the types of the elements of a list the
192#### Accepts
193#### Accepts
@@ -199,7 +200,7 @@ a `list`.
200#### Source
201#### Source
202− ++ homo :: homogenize
203+ ++ homo
203 |* a=(list)
204 |* a=(list)
205 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
206 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
@@ -211,11 +212,14 @@ a `list`.
213 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
214 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
214 > (homo lyst)
216 > (homo lyst)
215 ~[1 97 2 98 [~ u=10]]
217 ~[1 97 2 98 [~ u=10]]
216 > =a (limo [1 2 3 ~])
219 > =a (limo [1 2 3 ~])
218 [i=1 t=[i=2 t=[i=3 t=~]]]
221 [i=1 t=[i=2 t=[i=3 t=~]]]
219 > (homo a)
223 > (homo a)
@@ -238,7 +242,7 @@ an atom.
239#### Source
243#### Source
241− ++ lent :: length
245+ ++ lent
243 |= a=(list)
247 |= a=(list)
@@ -314,7 +318,7 @@ every element of `++list` `a`.
315#### Source
319#### Source
317− ++ lien :: some of
321+ ++ lien
319 |* [a=(list) b=$-(* ?)]
323 |* [a=(list) b=$-(* ?)]
@@ -327,6 +331,7 @@ every element of `++list` `a`.
327 > =a |=(a=@ (gte a 1))
331 > =a |=(a=@ (gte a 1))
328 > (lien `(list @)`[0 1 2 1 ~] a)
332 > (lien `(list @)`[0 1 2 1 ~] a)
330 > =a |=(a=@ (gte a 3))
335 > =a |=(a=@ (gte a 3))
331 > (lien `(list @)`[0 1 2 1 ~]) a)
336 > (lien `(list @)`[0 1 2 1 ~]) a)
@@ -862,13 +867,15 @@ A list.
862#### Source
867#### Source
865− |* [a=(list) b=_|=([* *] [** +<+]) c/*]
871+ |* [a=(list) b=* c=_|=(^ [** +<+])]
866− :: ?< ?=($-([_?<(?=($~ a) i.a) _c] [* _c]) b)
872+ => .(c `$-([_?>(?=(^ a) i.a) _b] [_-:(c) _b])`c)
867− |-
873+ =/ acc=(list _-:(c)) ~
874+ |- ^- (pair _acc _b)
869− ~
876+ [(flop acc) b]
870− =+ v=(b i.a c)
877+ =^ res b (c i.a b)
871− [i=-.v t=$(a t.a, c +.v)]
878+ $(acc [res acc], a t.a)
874#### Examples
881#### Examples
@@ -885,7 +892,7 @@ A list.
885 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
892 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
887 > %^ spin (reap 10 0) :: Create 10 random numbers less than `10`
894 > %^ spin (reap 10 0) :: Create 10 random numbers less than `10`
888− |=([n=@ rng=_og] (rads:rng 10))
895+ |=([n=@ rng=_og] (rads:rng 10))
889 ~(. og eny)
896 ~(. og eny)
890 ~[5 5 9 4 1 7 9 9 9 6]
897 ~[5 5 9 4 1 7 9 9 9 6]
@@ -905,7 +912,8 @@ Gate to list, with state
905Accepts a `list` `a` and a gate `b`. `c` is internal state, initially
912Accepts a `list` `a` and a gate `b`. `c` is internal state, initially
906derived by *bunting* the tail of the sample of gate `b`, instead of
913derived by *bunting* the tail of the sample of gate `b`, instead of
907being passed in explicitly as in `++spin`. Produces a list with the
914being passed in explicitly as in `++spin`. Produces a list with the
908−gate applied to each element of the original list. `b` is called with a #### tuple the head is an element of `a` and the tail is the state `c`, and should
915+gate applied to each element of the original list. `b` is called with a tuple --
916+ the head is an element of `a` and the tail is the state `c`, and should
909produce a tuple of the transformed element and the (potentially modified)
917produce a tuple of the transformed element and the (potentially modified)
910state `c`.
918state `c`.
@@ -922,23 +930,19 @@ A list.
922#### Source
930#### Source
925− |* [a=(list) b=_|=([* *] [** +<+])]
934+ |* [a=(list) b=_|=(^ [** +<+])]
926− =| c/_+<+.b
935+ p:(spin a +<+.b b)
931− [i=-.v t=$(a t.a, c +.v)]
934#### Examples
938#### Examples
936− > %+ spun (limo ~[4 5 6]) ::`p` as the index and `q` as the list element
940+ > %+ spun (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
937 |=([n=@ a=@] [`(pair)`[a n] +(a)])
941 |=([n=@ a=@] [`(pair)`[a n] +(a)])
938 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
942 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
944+ > =l (limo ~[7 8 9])
940− > =l (limo ~[7 8 9]) ::joins two lists into a list of pairs
945+ > %+ spun (limo ~[4 5 6]) :: joins two lists into a list of pairs
941− > %+ spun (limo ~[4 5 6])
942 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
946 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
943 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
947 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
@@ -971,6 +975,7 @@ A list of the same type as `c`.
972 > (swag [2 5] "roly poly")
976 > (swag [2 5] "roly poly")
974 > (swag [2 2] (limo [1 2 3 4 ~]))
979 > (swag [2 2] (limo [1 2 3 4 ~]))
975 [i=3 t=[i=4 t=~]]
980 [i=3 t=[i=4 t=~]]
@@ -1039,6 +1044,7 @@ Concatenate two `++list`s `a` and `b`.
1040 > (weld "urb" "it")
1045 > (weld "urb" "it")
1041 ~[~~u ~~r ~~b ~~i ~~t]
1046 ~[~~u ~~r ~~b ~~i ~~t]
1042 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
1048 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
1043 ~[1 2 3 4]
1049 ~[1 2 3 4]
@@ -1078,13 +1084,16 @@ A list.
1079 > (welp "foo" "bar")
1085 > (welp "foo" "bar")
1080 "foobar"
1086 "foobar"
1081− ~zod/arvo=/hoon/hoon> (welp ~[60 61 62] ~[%a %b %c])
1088+ > (welp ~[60 61 62] ~[%a %b %c])
1082 [60 61 62 %a %b %c ~]
1089 [60 61 62 %a %b %c ~]
1083− ~zod/arvo=/hoon/hoon>? (welp ~[60 61 62] ~[%a %b %c])
1091+ > ? (welp ~[60 61 62] ~[%a %b %c])
1092+ {@ud @ud @ud $a $b $c $~}
1084 [60 61 62 %a %b %c ~]
1093 [60 61 62 %a %b %c ~]
1085− [@ud @ud @ud %a %b %c %~]
1094+
1086− ~zod/arvo=/hoon/hoon> (welp [sa+1 so+2 ~] si=3)
1095+ > (welp [sa+1 so+2 ~] si=3)
1087− [[%sa 1] [%so 2] %si 3]
1096+ [[%sa 1] [%so 2] si=3]
@@ -1121,7 +1130,7 @@ A list.
1122 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1131 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1123 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1132 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1125 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1134 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1126 ~[1 97 2 98 3 99 4 100]
1135 ~[1 97 2 98 3 99 4 100]