fez-lisp 1.0.35 → 1.0.37

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -82,12 +82,12 @@ npm i fez-lisp
82
82
 
83
83
  ```js
84
84
  import { fez } from 'fez-lisp'
85
- fez(`(log! "Hello World!")`)
85
+ fez(`(log! "Hello World!")`) // Hello World!
86
86
  ```
87
87
 
88
88
  ```js
89
89
  import { fez } from 'fez-lisp'
90
- fez(`(+ 1 "2")`, { errors: true })
90
+ fez(`(+ 1 "2")`) // Not all arguments of (+) are (number) (+ 1 2)
91
91
  ```
92
92
 
93
93
  ```js
@@ -101,7 +101,7 @@ eval(
101
101
  // include standard library
102
102
  // compile fez to JavaScript
103
103
  // tree shake standard library
104
- { std: true, compile: true, shake: true }
104
+ { std: true, compile: true }
105
105
  )
106
106
  )
107
107
  ```
@@ -117,7 +117,7 @@ fez(
117
117
  (*) n)))
118
118
 
119
119
  (|> (math:range 1 100) (array:map fizz-buzz) (log!))`,
120
- { std: true, errors: true, compile: false, shake: true }
120
+ { std: true, compile: false }
121
121
  )
122
122
  ```
123
123
 
@@ -167,3 +167,40 @@ console.log(
167
167
  )
168
168
  // 50005000
169
169
  ```
170
+
171
+ Pass tree source as text:
172
+
173
+ ```js
174
+ import { fez, parse } from '../index.js'
175
+ const source = `(|>
176
+ (array 1 2 3 4)
177
+ (math:permutations)
178
+ (array:flat-one)
179
+ (math:summation)
180
+ (log!))`
181
+ fez(source, {
182
+ std: 1,
183
+ mutation: 1
184
+ })
185
+ ```
186
+
187
+ Pass tree instead of a source:
188
+
189
+ ```js
190
+ import { fez, tree, std } from '../index.js'
191
+ const source = `(|>
192
+ (array 1 2 3 4)
193
+ (math:permutations)
194
+ (array:flat-one)
195
+ (math:summation)
196
+ (log!))`
197
+ const ast = tree(source, std)
198
+ fez(ast, { mutation: 1 })
199
+ ```
200
+
201
+ If passing AST and STD is not used then use tree with a single arugment
202
+
203
+ ```js
204
+ import { fez, tree } from '../index.js'
205
+ console.log(fez(tree(`(+ (|> 1 (+ 2) (* 3) (- 1)) (- (* (+ 1 2) 3) 1))`)))
206
+ ```
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { evaluate } from './src/interpreter.js'
2
2
  import { parse, stringify } from './src/parser.js'
3
- import { fez } from './src/utils.js'
3
+ import { fez, tree } from './src/utils.js'
4
4
  import std from './lib/baked/std.js'
5
5
  import { keywords } from './src/tokeniser.js'
6
6
  import { WORD, APPLY, ATOM, VALUE, TYPE } from './src/enums.js'
7
7
  const types = { WORD, APPLY, ATOM, VALUE, TYPE }
8
- export { fez, parse, stringify, keywords, evaluate, std, types }
8
+ export { fez, parse, stringify, keywords, evaluate, std, types, tree }
package/lib/baked/std.js CHANGED
@@ -1 +1 @@
1
- export default [[[0,"let"],[1,"math:E"],[2,2.718281828459045]],[[0,"let"],[1,"math:PI"],[2,3.141592653589793]],[[0,"let"],[1,"math:range"],[[0,"lambda"],[1,"start"],[1,"end"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<="],[1,"count"],[1,"end"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[1,"start"]]]]],[[0,"let"],[1,"math:sequence"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"end"],[[0,"length"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"out"]],[1,"end"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[2,0]]]]],[[0,"let"],[1,"math:sequence-n"],[[0,"lambda"],[1,"n"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"out"]],[1,"n"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[2,0]]]]],[[0,"let"],[1,"math:permutations"],[[0,"lambda"],[1,"xs"],[[0,"unless"],[[0,"length"],[1,"xs"]],[[0,"array"],[]],[[0,"|>"],[1,"xs"],[[0,"array:enumerated-map"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"|>"],[1,"xs"],[[0,"array:enumerated-exclude"],[[0,"lambda"],[1,"."],[1,"j"],[[0,"="],[1,"i"],[1,"j"]]]],[[0,"math:permutations"]],[[0,"array:map"],[[0,"lambda"],[1,"vs"],[[0,"array:merge"],[[0,"array"],[1,"x"]],[1,"vs"]]]]]]],[[0,"array:flat-one"]]]]]],[[0,"let"],[1,"math:greater?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,">"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:lesser?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"<"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:lesser-or-equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"<="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:greater-or-equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,">="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:addition"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"+"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:multiplication"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:division"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"/"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:subtraction"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:summation"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"+"],[1,"a"],[1,"b"]]],[[0,"+"]]]]],[[0,"let"],[1,"math:product"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"]]],[[0,"*"]]]]],[[0,"let"],[1,"math:maximum"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]],[[0,"car"],[1,"arr"]]]]],[[0,"let"],[1,"math:minimum"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"<"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]],[[0,"car"],[1,"arr"]]]]],[[0,"let"],[1,"math:max"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:min"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"<"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:increment"],[[0,"safety"],[1,"lambda"],[1,"i"],[[0,"+"],[1,"i"],[2,1]]]],[[0,"let"],[1,"math:floor"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"|"],[1,"n"],[2,0]]]],[[0,"let"],[1,"math:round"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"|"],[[0,"+"],[1,"n"],[2,0.5]],[2,0]]]],[[0,"let"],[1,"math:set-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"bit"],[[0,"|"],[1,"n"],[[0,"<<"],[2,1],[1,"bit"]]]]],[[0,"let"],[1,"math:clear-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"bit"],[[0,"&"],[1,"n"],[[0,"~"],[[0,"<<"],[2,1],[1,"bit"]]]]]],[[0,"let"],[1,"math:odd-bit?"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"="],[[0,"&"],[1,"n"],[2,1]],[2,1]]]],[[0,"let"],[1,"math:average-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">>"],[[0,"+"],[1,"a"],[1,"b"]],[2,1]]]],[[0,"let"],[1,"math:toggle-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"a"],[1,"b"],[[0,"^"],[1,"a"],[1,"b"],[1,"n"]]]],[[0,"let"],[1,"math:same-sign-bit?"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">="],[[0,"^"],[1,"a"],[1,"b"]],[2,0]]]],[[0,"let"],[1,"math:max-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[[0,"&"],[[0,"-"],[1,"a"],[1,"b"]],[[0,">>"],[[0,"-"],[1,"a"],[1,"b"]],[2,31]]]]]],[[0,"let"],[1,"math:min-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[[0,"&"],[[0,"-"],[1,"a"],[1,"b"]],[[0,">>"],[[0,"-"],[1,"b"],[1,"a"]],[2,31]]]]]],[[0,"let"],[1,"math:modulo-bit"],[[0,"safety"],[1,"lambda"],[1,"numerator"],[1,"divisor"],[[0,"&"],[1,"numerator"],[[0,"-"],[1,"divisor"],[2,1]]]]],[[0,"let"],[1,"math:n-one-bit?"],[[0,"safety"],[1,"lambda"],[1,"N"],[1,"nth"],[[0,"type"],[[0,"&"],[1,"N"],[[0,"<<"],[2,1],[1,"nth"]]],[1,"boolean"]]]],[[0,"let"],[1,"math:square"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"*"],[1,"x"],[1,"x"]]]],[[0,"let"],[1,"math:power"],[[0,"lambda"],[1,"base"],[1,"exp"],[[0,"if"],[[0,"<"],[1,"exp"],[2,0]],[[0,"if"],[[0,"="],[1,"base"],[2,0]],[[0,"throw"],[2,"Attempting to divide by 0 in (math:power)"]],[[0,"/"],[[0,"*"],[1,"base"],[[0,"math:power"],[1,"base"],[[0,"-"],[[0,"*"],[1,"exp"],[2,-1]],[2,1]]]]]],[[0,"cond"],[[0,"="],[1,"exp"],[2,0]],[2,1],[[0,"="],[1,"exp"],[2,1]],[1,"base"],[[0,"*"]],[[0,"*"],[1,"base"],[[0,"math:power"],[1,"base"],[[0,"-"],[1,"exp"],[2,1]]]]]]]],[[0,"let"],[1,"math:greatest-common-divisor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let*"],[1,"gcd"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"="],[1,"b"],[2,0]],[1,"a"],[[0,"gcd"],[1,"b"],[[0,"mod"],[1,"a"],[1,"b"]]]]]],[[0,"gcd"],[1,"a"],[1,"b"]]]]],[[0,"let"],[1,"math:least-common-divisor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"],[[0,"/"],[[0,"math:greatest-common-divisor"],[1,"a"],[1,"b"]]]]]],[[0,"let"],[1,"math:sqrt"],[[0,"lambda"],[1,"x"],[[0,"do"],[[0,"let"],[1,"is-good-enough"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"<"],[[0,"math:abs"],[[0,"-"],[[0,"math:square"],[1,"g"]],[1,"x"]]],[2,0.01]]]],[[0,"let"],[1,"improve-guess"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"math:average"],[1,"g"],[[0,"*"],[1,"x"],[[0,"/"],[1,"g"]]]]]],[[0,"let*"],[1,"math:sqrt-iter"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"if"],[[0,"is-good-enough"],[1,"g"],[1,"x"]],[1,"g"],[[0,"math:sqrt-iter"],[[0,"improve-guess"],[1,"g"],[1,"x"]],[1,"x"]]]]],[[0,"math:sqrt-iter"],[2,1],[1,"x"]]]]],[[0,"let"],[1,"math:circumference"],[[0,"lambda"],[1,"radius"],[[0,"*"],[1,"math:PI"],[[0,"*"],[1,"radius"],[2,2]]]]],[[0,"let"],[1,"math:hypotenuse"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"math:sqrt"],[[0,"+"],[[0,"*"],[1,"a"],[1,"a"]],[[0,"*"],[1,"b"],[1,"b"]]]]]],[[0,"let"],[1,"math:abs"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"-"],[[0,"^"],[1,"n"],[[0,">>"],[1,"n"],[2,31]]],[[0,">>"],[1,"n"],[2,31]]]]],[[0,"let"],[1,"math:nth-digit"],[[0,"lambda"],[1,"digit"],[1,"n"],[[0,"|"],[[0,"mod"],[[0,"/"],[1,"digit"],[[0,"math:power"],[2,10],[[0,"-"],[1,"n"],[2,1]]]],[2,10]],[2,0.5]]]],[[0,"let"],[1,"math:normalize"],[[0,"safety"],[1,"lambda"],[1,"value"],[1,"math:min"],[1,"math:max"],[[0,"*"],[[0,"-"],[1,"value"],[1,"math:min"]],[[0,"/"],[[0,"-"],[1,"math:max"],[1,"math:min"]]]]]],[[0,"let"],[1,"math:linear-interpolation"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[1,"n"],[[0,"+"],[[0,"*"],[[0,"-"],[2,1],[1,"n"]],[1,"a"]],[[0,"*"],[1,"n"],[1,"b"]]]]],[[0,"let"],[1,"math:gauss-sum"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"*"],[1,"n"],[[0,"+"],[1,"n"],[2,1]],[2,0.5]]]],[[0,"let"],[1,"math:gauss-sum-sequance"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[[0,"+"],[1,"a"],[1,"b"]],[[0,"+"],[[0,"-"],[1,"b"],[1,"a"]],[2,1]],[2,0.5]]]],[[0,"let"],[1,"math:clamp"],[[0,"safety"],[1,"lambda"],[1,"x"],[1,"limit"],[[0,"if"],[[0,">"],[1,"x"],[1,"limit"]],[1,"limit"],[1,"x"]]]],[[0,"let"],[1,"math:odd?"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"="],[[0,"mod"],[1,"x"],[2,2]],[2,1]]]],[[0,"let"],[1,"math:even?"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"="],[[0,"mod"],[1,"x"],[2,2]],[2,0]]]],[[0,"let"],[1,"math:enumerated-odd?"],[[0,"safety"],[1,"lambda"],[1,"."],[1,"i"],[[0,"="],[[0,"mod"],[1,"i"],[2,2]],[2,1]]]],[[0,"let"],[1,"math:enumerated-even?"],[[0,"safety"],[1,"lambda"],[1,"."],[1,"i"],[[0,"="],[[0,"mod"],[1,"i"],[2,2]],[2,0]]]],[[0,"let"],[1,"math:sign"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"if"],[[0,"<"],[1,"n"],[2,0]],[2,-1],[2,1]]]],[[0,"let"],[1,"math:radians"],[[0,"lambda"],[1,"deg"],[[0,"*"],[1,"deg"],[1,"math:PI"],[[0,"/"],[2,180]]]]],[[0,"let"],[1,"math:average"],[[0,"safety"],[1,"lambda"],[1,"x"],[1,"y"],[[0,"*"],[[0,"+"],[1,"x"],[1,"y"]],[2,0.5]]]],[[0,"let"],[1,"math:euclidean-mod"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"mod"],[[0,"+"],[[0,"mod"],[1,"a"],[1,"b"]],[1,"b"]],[1,"b"]]]],[[0,"let"],[1,"math:euclidean-distance"],[[0,"lambda"],[1,"x1"],[1,"y1"],[1,"x2"],[1,"y2"],[[0,"do"],[[0,"let"],[1,"a"],[[0,"-"],[1,"x1"],[1,"x2"]]],[[0,"let"],[1,"b"],[[0,"-"],[1,"y1"],[1,"y2"]]],[[0,"math:sqrt"],[[0,"+"],[[0,"*"],[1,"a"],[1,"a"]],[[0,"*"],[1,"b"],[1,"b"]]]]]]],[[0,"let"],[1,"math:manhattan-distance"],[[0,"lambda"],[1,"x1"],[1,"y1"],[1,"x2"],[1,"y2"],[[0,"+"],[[0,"math:abs"],[[0,"-"],[1,"x2"],[1,"x1"]]],[[0,"math:abs"],[[0,"-"],[1,"y2"],[1,"y1"]]]]]],[[0,"let"],[1,"math:positive?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,">"],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:negative?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,"<"],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:zero?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,"="],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:divisible?"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"="],[[0,"mod"],[1,"a"],[1,"b"]],[2,0]]]],[[0,"let"],[1,"math:prime?"],[[0,"lambda"],[1,"n"],[[0,"cond"],[[0,"="],[1,"n"],[2,1]],[2,0],[[0,"<"],[1,"n"],[2,0]],[2,0],[[0,"*"]],[[0,"do"],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"i"],[1,"end"],[[0,"do"],[[0,"let"],[1,"is-prime"],[[0,"not"],[[0,"="],[[0,"mod"],[1,"n"],[1,"i"]],[2,0]]]],[[0,"if"],[[0,"and"],[[0,"<="],[1,"i"],[1,"end"]],[1,"is-prime"]],[[0,"iter"],[[0,"+"],[1,"i"],[2,1]],[1,"end"]],[1,"is-prime"]]]]],[[0,"or"],[[0,"="],[1,"n"],[2,2]],[[0,"iter"],[2,2],[[0,"math:sqrt"],[1,"n"]]]]]]]],[[0,"let"],[1,"math:largest-power"],[[0,"safety"],[1,"lambda"],[1,"N"],[[0,"do"],[[0,"let"],[1,"N1"],[[0,"|"],[1,"N"],[[0,">>"],[1,"N"],[2,1]]]],[[0,"let"],[1,"N2"],[[0,"|"],[1,"N1"],[[0,">>"],[1,"N1"],[2,2]]]],[[0,"let"],[1,"N3"],[[0,"|"],[1,"N2"],[[0,">>"],[1,"N2"],[2,4]]]],[[0,"let"],[1,"N4"],[[0,"|"],[1,"N3"],[[0,">>"],[1,"N3"],[2,8]]]],[[0,">>"],[[0,"+"],[1,"N4"],[2,1]],[2,1]]]]],[[0,"let"],[1,"math:cartesian-product"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:fold"],[1,"a"],[[0,"lambda"],[1,"p"],[1,"x"],[[0,"array:merge!"],[1,"p"],[[0,"array:map"],[1,"b"],[[0,"lambda"],[1,"y"],[[0,"array"],[1,"x"],[1,"y"]]]]]],[]]]],[[0,"let*"],[1,"array:for"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"when"],[[0,"length"],[1,"arr"]],[[0,"do"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"array:for"],[[0,"cdr"],[1,"arr"]],[1,"callback"]]]]]],[[0,"let"],[1,"array:map"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"callback"],[[0,"car"],[1,"arr"]]]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:select"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:exclude"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"if"],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:fold"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[1,"initial"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"callback"],[1,"out"],[[0,"car"],[1,"arr"]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[1,"initial"]]]]],[[0,"let"],[1,"array:every?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"callback"],[[0,"car"],[1,"arr"]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]],[[0,"not"],[[0,"length"],[1,"arr"]]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:some?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]],[[0,"type"],[[0,"length"],[1,"arr"]],[1,"boolean"]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:find"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"car"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]]],[]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:has?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"when"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[2,1],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:reverse"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"array:merge!"],[[0,"array"],[[0,"car"],[1,"arr"]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:append!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[1,"q"],[[0,"length"],[1,"q"]],[1,"item"]]]],[[0,"let"],[1,"array:tail!"],[[0,"lambda"],[1,"q"],[[0,"array:set!"],[1,"q"],[2,-1]]]],[[0,"let"],[1,"array:push!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"array:set!"],[1,"q"],[[0,"length"],[1,"q"]],[1,"item"]],[1,"item"]]]],[[0,"let"],[1,"array:pop!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"l"],[[0,"array:get"],[1,"q"],[2,-1]]],[[0,"array:set!"],[1,"q"],[2,-1]],[1,"l"]]]],[[0,"let"],[1,"array:unique"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[[0,"let"],[1,"sorted"],[[0,"array:sort"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">"],[1,"a"],[1,"b"]]]]],[[0,"array:zip"],[[0,"math:sequence"],[1,"sorted"]]],[[0,"array:select"],[[0,"lambda"],[1,"x"],[[0,"or"],[[0,"not"],[[0,"let"],[1,"index"],[[0,"car"],[[0,"cdr"],[1,"x"]]]]],[[0,"not"],[[0,"="],[[0,"array:get"],[1,"sorted"],[[0,"-"],[1,"index"],[2,1]]],[[0,"array:get"],[1,"sorted"],[1,"index"]]]]]]],[[0,"array:map"],[1,"car"]]]]],[[0,"let"],[1,"array:for-range"],[[0,"safety"],[1,"lambda"],[1,"start"],[1,"end"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[[0,"when"],[[0,"<"],[1,"i"],[1,"end"]],[[0,"do"],[[0,"callback"],[1,"i"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]]]]]]],[[0,"iterate"],[1,"start"]]]]],[[0,"let"],[1,"array:traverse"],[[0,"lambda"],[1,"x"],[1,"callback"],[[0,"if"],[[0,"atom?"],[1,"x"]],[[0,"callback"],[1,"x"]],[[0,"iterate"],[1,"x"],[[0,"lambda"],[1,"y"],[[0,"array:traverse"],[1,"y"],[1,"callback"]]]]]]],[[0,"let"],[1,"array:empty?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"not"],[[0,"length"],[1,"arr"]]]]],[[0,"let"],[1,"array:count-of"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"|>"],[1,"arr"],[[0,"array:select"],[1,"callback"]],[[0,"length"]]]]],[[0,"let"],[1,"array:empty!"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"do"],[[0,"array:set!"],[1,"arr"],[2,-1]],[[0,"iterate"]]],[1,"arr"]]]],[[0,"iterate"]]]]],[[0,"let"],[1,"array:in-bounds?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"index"],[[0,"and"],[[0,"<"],[1,"index"],[[0,"length"],[1,"arr"]]],[[0,">="],[1,"index"],[2,0]]]]],[[0,"let"],[1,"array:slice"],[[0,"lambda"],[1,"arr"],[1,"start"],[1,"end"],[[0,"do"],[[0,"let"],[1,"bounds"],[[0,"-"],[1,"end"],[1,"start"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"out"],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"array:get"],[1,"arr"],[[0,"+"],[1,"start"],[1,"i"]]]]]],[1,"out"]]]],[[0,"iterate"],[2,0],[]]]]],[[0,"let"],[1,"array:binary-search"],[[0,"lambda"],[1,"arr"],[1,"target"],[[0,"do"],[[0,"let*"],[1,"search"],[[0,"lambda"],[1,"arr"],[1,"target"],[1,"start"],[1,"end"],[[0,"do"],[[0,"when"],[[0,"<="],[1,"start"],[1,"end"]],[[0,"do"],[[0,"let"],[1,"index"],[[0,"math:floor"],[[0,"*"],[[0,"+"],[1,"start"],[1,"end"]],[2,0.5]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"index"]]],[[0,"if"],[[0,"="],[1,"target"],[1,"current"]],[1,"target"],[[0,"if"],[[0,">"],[1,"current"],[1,"target"]],[[0,"search"],[1,"arr"],[1,"target"],[1,"start"],[[0,"-"],[1,"index"],[2,1]]],[[0,"search"],[1,"arr"],[1,"target"],[[0,"+"],[1,"index"],[2,1]],[1,"end"]]]]]]]]],[[0,"search"],[1,"arr"],[1,"target"],[2,0],[[0,"length"],[1,"arr"]]]]]],[[0,"let"],[1,"array:zip"],[[0,"lambda"],[1,"A"],[1,"B"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"a"],[1,"b"],[1,"output"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"iterate"],[[0,"cdr"],[1,"a"]],[[0,"cdr"],[1,"b"]],[[0,"array:merge!"],[1,"output"],[[0,"array"],[[0,"array"],[[0,"car"],[1,"a"]],[[0,"car"],[1,"b"]]]]]],[1,"output"]]]],[[0,"iterate"],[1,"A"],[1,"B"],[]]]]],[[0,"let"],[1,"array:equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"or"],[[0,"and"],[[0,"number?"],[1,"a"]],[[0,"number?"],[1,"b"]],[[0,"="],[1,"a"],[1,"b"]]],[[0,"and"],[[0,"string?"],[1,"a"]],[[0,"string?"],[1,"b"]],[[0,"string:equal?"],[1,"a"],[1,"b"]]],[[0,"and"],[[0,"array?"],[1,"a"]],[[0,"="],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"not"],[[0,"array:some?"],[[0,"math:sequence"],[1,"a"]],[[0,"lambda"],[1,"i"],[[0,"not"],[[0,"array:equal?"],[[0,"array:get"],[1,"a"],[1,"i"]],[[0,"array:get"],[1,"b"],[1,"i"]]]]]]]]]]],[[0,"let"],[1,"array:join"],[[0,"lambda"],[1,"arr"],[1,"delim"],[[0,"array:fold"],[[0,"array:zip"],[1,"arr"],[[0,"math:sequence"],[1,"arr"]]],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[2,0]],[[0,"string:merge"],[1,"a"],[1,"delim"],[[0,"type"],[[0,"car"],[1,"b"]],[1,"string"]]],[[0,"type"],[[0,"car"],[1,"b"]],[1,"string"]]]],[2,""]]]],[[0,"let"],[1,"array:flat-one"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:merge!"],[1,"a"],[[0,"if"],[[0,"array?"],[1,"b"]],[1,"b"],[[0,"array"],[1,"b"]]]]],[]]]],[[0,"let"],[1,"array:flat"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"flatten"],[[0,"lambda"],[1,"item"],[[0,"if"],[[0,"and"],[[0,"array?"],[1,"item"]],[[0,"length"],[1,"item"]]],[[0,"array:fold"],[1,"item"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:merge!"],[1,"a"],[[0,"flatten"],[1,"b"]]]],[]],[[0,"array"],[1,"item"]]]]],[[0,"flatten"],[1,"arr"]]]]],[[0,"let"],[1,"array:sort"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"if"],[[0,"<="],[[0,"length"],[1,"arr"]],[2,1]],[1,"arr"],[[0,"do"],[[0,"let"],[1,"pivot"],[[0,"car"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"bounds"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"i"]]],[[0,"let"],[1,"predicate"],[[0,"callback"],[1,"current"],[1,"pivot"]]],[[0,"let"],[1,"left"],[[0,"if"],[[0,"="],[1,"predicate"],[2,0]],[[0,"array:merge"],[1,"a"],[[0,"array"],[1,"current"]]],[1,"a"]]],[[0,"let"],[1,"right"],[[0,"if"],[[0,"="],[1,"predicate"],[2,1]],[[0,"array:merge"],[1,"b"],[[0,"array"],[1,"current"]]],[1,"b"]]],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"],[1,"left"],[1,"right"]],[[0,"array"],[1,"left"],[1,"right"]]]]]],[[0,"let"],[1,"sorted"],[[0,"iterate"],[2,1],[[0,"-"],[[0,"length"],[1,"arr"]],[2,1]],[],[]]],[[0,"let"],[1,"left"],[[0,"car"],[1,"sorted"]]],[[0,"let"],[1,"right"],[[0,"car"],[[0,"cdr"],[1,"sorted"]]]],[[0,"array:merge"],[[0,"array:sort"],[1,"left"],[1,"callback"]],[[0,"array"],[1,"pivot"]],[[0,"array:sort"],[1,"right"],[1,"callback"]]]]]]]],[[0,"let"],[1,"array:sorted-ascending?"],[[0,"lambda"],[1,"arr"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,">="],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:sorted-descending?"],[[0,"lambda"],[1,"arr"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,"<="],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:sorted-by?"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,"callback"],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:set"],[[0,"lambda"],[1,"arr"],[1,"index"],[1,"item"],[[0,"array:set!"],[[0,"type"],[1,"arr"],[1,"array"]],[1,"index"],[1,"item"]]]],[[0,"let"],[1,"array:adjacent-difference"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"length"],[1,"arr"]]],[[0,"unless"],[[0,"="],[1,"len"],[2,1]],[[0,"do"],[[0,"array"],[[0,"car"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"result"],[[0,"if"],[[0,"<"],[1,"i"],[1,"len"]],[[0,"do"],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[[0,"array:set!"],[1,"result"],[1,"i"],[[0,"callback"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]],[[0,"array:get"],[1,"arr"],[1,"i"]]]]]],[1,"result"]]]],[[0,"iterate"],[2,1],[1,"arr"]]],[1,"arr"]]]]],[[0,"let"],[1,"array:adjacent-find"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"length"],[1,"arr"]]],[[0,"otherwise"],[[0,"="],[1,"len"],[2,1]],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[[0,"if"],[[0,"<"],[1,"i"],[1,"len"]],[[0,"if"],[[0,"callback"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"i"]]]],[1,"prev"],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]]]],[]]]],[[0,"iterate"],[2,1]]]]]]],[[0,"let"],[1,"array:adjacent"],[[0,"lambda"],[1,"arr"],[1,"directions"],[1,"y"],[1,"x"],[1,"callback"],[[0,"array:for"],[1,"directions"],[[0,"lambda"],[1,"dir"],[[0,"do"],[[0,"let"],[1,"dy"],[[0,"+"],[[0,"car"],[1,"dir"]],[1,"y"]]],[[0,"let"],[1,"dx"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"dir"]]],[1,"x"]]],[[0,"when"],[[0,"and"],[[0,"array:in-bounds?"],[1,"arr"],[1,"dy"]],[[0,"array:in-bounds?"],[[0,"array:get"],[1,"arr"],[1,"dy"]],[1,"dx"]]],[[0,"callback"],[[0,"array:get"],[[0,"array:get"],[1,"arr"],[1,"dy"]],[1,"dx"]],[1,"dir"]]]]]]]],[[0,"let"],[1,"array:partition"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"array:fold"],[[0,"array:zip"],[1,"arr"],[[0,"math:sequence"],[1,"arr"]]],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"x"],[[0,"car"],[1,"b"]]],[[0,"let"],[1,"i"],[[0,"car"],[[0,"cdr"],[1,"b"]]]],[[0,"if"],[[0,"mod"],[1,"i"],[1,"n"]],[[0,"array:set!"],[[0,"let"],[1,"last-a"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"length"],[1,"last-a"]],[1,"x"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[[0,"do"],[[0,"let"],[1,"mut-arr"],[]],[[0,"array:set!"],[1,"mut-arr"],[[0,"length"],[1,"mut-arr"]],[1,"x"]]]]],[1,"a"]]],[]]]],[[0,"let"],[1,"cast:array->set"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"s"],[[0,"array"],[],[],[],[]]],[[0,"array:for"],[1,"arr"],[[0,"lambda"],[1,"x"],[[0,"set:add!"],[1,"s"],[1,"x"]]]],[1,"s"]]]],[[0,"let"],[1,"cast:string->chars"],[[0,"safety"],[1,"lambda"],[1,"str"],[[0,"type"],[1,"str"],[1,"array"]]]],[[0,"let"],[1,"cast:chars->string"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"x"],[[0,"string:merge"],[1,"a"],[[0,"type"],[1,"x"],[1,"string"]]]],[2,""]]]],[[0,"let"],[1,"cast:string->number"],[[0,"safety"],[1,"lambda"],[1,"str"],[[0,"type"],[1,"str"],[1,"number"]]]],[[0,"let"],[1,"cast:number->string"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"type"],[1,"n"],[1,"string"]]]],[[0,"let"],[1,"cast:strings->numbers"],[[0,"lambda"],[1,"arr"],[[0,"array:map"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"number"]]]]]],[[0,"let"],[1,"cast:numbers->strings"],[[0,"lambda"],[1,"arr"],[[0,"array:map"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"string"]]]]]],[[0,"let"],[1,"cast:string->char-codes"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char-code"]]]]]]],[[0,"let"],[1,"cast:chars->char-codes"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char-code"]]]]]]],[[0,"let"],[1,"cast:chars->numbers"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"number"]]]]]]],[[0,"let"],[1,"cast:char->number"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"number"]]]],[[0,"let"],[1,"cast:char->char-code"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"char-code"]]]],[[0,"let"],[1,"cast:char-code->char"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"char"]]]],[[0,"let"],[1,"cast:char-codes->chars"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char"]]]]]]],[[0,"let"],[1,"cast:char-codes->string"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char"]]]],[[0,"cast:chars->string"]]]]],[[0,"let"],[1,"cast:table->array"],[[0,"lambda"],[1,"set"],[[0,"array:select"],[[0,"array:flat"],[1,"set"]],[1,"atom?"]]]],[[0,"let"],[1,"cast:map->string"],[[0,"lambda"],[1,"table"],[[0,"|>"],[1,"table"],[[0,"array:select"],[1,"length"]],[[0,"array:flat-one"]],[[0,"array:map"],[[0,"lambda"],[1,"y"],[[0,"array:join"],[1,"y"],[2," -> "]]]],[[0,"array:join"],[2,"\n"]]]]],[[0,"let"],[1,"cast:array->brray"],[[0,"lambda"],[1,"initial"],[[0,"do"],[[0,"let"],[1,"q"],[[0,"new:brray"]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[[0,"length"],[1,"initial"]],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[[0,"length"],[1,"initial"]],[2,1]]],[1,"q"]]]],[[0,"let"],[1,"cast:brray->array"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"out"],[]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"array:set!"],[1,"out"],[[0,"length"],[1,"out"]],[[0,"brray:get"],[1,"q"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[[0,"-"],[[0,"brray:length"],[1,"q"]],[2,1]]],[1,"out"]]]],[[0,"let"],[1,"string:split"],[[0,"lambda"],[1,"str"],[1,"delim"],[[0,"do"],[[0,"let"],[1,"locals"],[]],[[0,"let"],[1,"delim-arr"],[[0,"type"],[1,"delim"],[1,"array"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[1,"delim-arr"]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[[0,"type"],[1,"str"],[1,"array"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[[0,"length"],[1,"delim-arr"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[2,""]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"result"],[1,"i"],[1,"bounds"],[[0,"if"],[[0,"<"],[[0,"if"],[[0,"array:every?"],[[0,"array:zip"],[[0,"array:get"],[1,"locals"],[2,0]],[[0,"math:sequence"],[1,"locals"]]],[[0,"lambda"],[1,"item"],[[0,"do"],[[0,"let"],[1,"y"],[[0,"car"],[1,"item"]]],[[0,"let"],[1,"j"],[[0,"car"],[[0,"cdr"],[1,"item"]]]],[[0,"or"],[[0,"<="],[[0,"length"],[[0,"array:get"],[1,"locals"],[2,1]]],[[0,"+"],[1,"i"],[1,"j"]]],[[0,"="],[[0,"type"],[[0,"array:get"],[[0,"array:get"],[1,"locals"],[2,1]],[[0,"+"],[1,"i"],[1,"j"]]],[1,"char-code"]],[[0,"type"],[1,"y"],[1,"char-code"]]]]]]],[[0,"do"],[[0,"array:set!"],[1,"result"],[[0,"length"],[1,"result"]],[[0,"array:get"],[1,"locals"],[2,3]]],[[0,"array:set!"],[1,"locals"],[2,3],[2,""]],[[0,"+"],[1,"i"],[[0,"array:get"],[1,"locals"],[2,2]],[2,-1]]],[[0,"do"],[[0,"array:set!"],[1,"locals"],[2,3],[[0,"string:merge"],[[0,"array:get"],[1,"locals"],[2,3]],[[0,"array:get"],[[0,"array:get"],[1,"locals"],[2,1]],[1,"i"]]]],[1,"i"]]],[1,"bounds"]],[[0,"iterate"],[1,"result"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"]],[1,"result"]]]],[[0,"array:set!"],[[0,"let"],[1,"iteration-result"],[[0,"iterate"],[],[2,0],[[0,"-"],[[0,"length"],[[0,"array:get"],[1,"locals"],[2,1]]],[2,1]]]],[[0,"length"],[1,"iteration-result"]],[[0,"array:get"],[1,"locals"],[2,3]]]]]],[[0,"let"],[1,"array:shallow-copy"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[1,"b"]]],[]]]],[[0,"let"],[1,"array:deep-copy"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[[0,"if"],[[0,"array?"],[1,"b"]],[[0,"array:deep-copy"],[1,"b"]],[1,"b"]]]],[]]]],[[0,"let"],[1,"array:merge!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"array:for"],[1,"b"],[[0,"lambda"],[1,"x"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[1,"x"]]]],[1,"a"]]]],[[0,"let"],[1,"array:swap-remove!"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"do"],[[0,"array:set!"],[1,"arr"],[1,"i"],[[0,"array:get"],[1,"arr"],[[0,"-"],[[0,"length"],[1,"arr"]],[2,1]]]],[[0,"array:set!"],[1,"arr"],[2,-1]]]]],[[0,"let"],[1,"array:index-of"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"item"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"="],[[0,"car"],[1,"arr"]],[1,"item"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerate"],[[0,"lambda"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]],[1,"arr"]]]],[[0,"let"],[1,"array:enumerated-map"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-select"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-exclude"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"if"],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-fold"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[1,"initial"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"callback"],[1,"out"],[[0,"car"],[1,"arr"]],[1,"i"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[1,"initial"]]]]],[[0,"let"],[1,"array:enumerated-find"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[[0,"car"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-find-index"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-every?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]],[[0,"not"],[[0,"length"],[1,"arr"]]]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-some?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]],[[0,"type"],[[0,"length"],[1,"arr"]],[1,"boolean"]]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:find-index"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:remove"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"x"],[[0,"do"],[[0,"unless"],[[0,"="],[1,"x"],[1,"i"]],[[0,"array:merge!"],[1,"a"],[[0,"array"],[1,"x"]]],[1,"a"]]]],[]]]],[[0,"let"],[1,"array:pad-right"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge"],[1,"b"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]]],[[0,"array:merge"],[1,"a"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]]]]]],[[0,"let"],[1,"array:pad-left"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]],[1,"b"]],[[0,"array:merge"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]],[1,"a"]]]]],[[0,"let"],[1,"array:pad-right!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge!"],[1,"b"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]]],[[0,"array:merge!"],[1,"a"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]]]]]],[[0,"let"],[1,"array:pad-left!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge!"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]],[1,"b"]],[[0,"array:merge!"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]],[1,"a"]]]]],[[0,"let"],[1,"array:rotate-right"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"|>"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"mod"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[1,"n"]],[[0,"length"],[1,"arr"]]],[[0,"car"],[1,"b"]]]],[[0,"array"],[[0,"length"],[1,"arr"]],[1,"length"]]]]]],[[0,"let"],[1,"array:rotate-left"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"|>"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"mod"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[[0,"-"],[[0,"length"],[1,"arr"]],[1,"n"]]],[[0,"length"],[1,"arr"]]],[[0,"car"],[1,"b"]]]],[[0,"array"],[[0,"length"],[1,"arr"]],[1,"length"]]]]]],[[0,"let"],[1,"array:first"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"array:get"],[1,"arr"],[2,0]]]],[[0,"let"],[1,"array:last"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"array:get"],[1,"arr"],[2,-1]]]],[[0,"let"],[1,"string:index-of-char"],[[0,"lambda"],[1,"str"],[1,"character"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"string:equal?"],[[0,"car"],[1,"arr"]],[1,"character"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[[0,"type"],[1,"str"],[1,"array"]],[2,0]]]]],[[0,"let"],[1,"string:match"],[[0,"lambda"],[1,"str"],[1,"word"],[[0,"do"],[[0,"let"],[1,"string-arr"],[[0,"type"],[1,"str"],[1,"array"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"string:equal?"],[[0,"|>"],[1,"string-arr"],[[0,"array:slice"],[1,"i"],[[0,"+"],[1,"i"],[[0,"length"],[1,"word"]]]],[[0,"array:join"],[2,""]]],[1,"word"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"toArr"],[2,0]]]]],[[0,"let"],[1,"string:greater?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"otherwise"],[[0,"string:equal?"],[1,"L"],[1,"R"]],[[0,"do"],[[0,"let"],[1,"A"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"L"],[1,"string"]]]],[[0,"let"],[1,"B"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"R"],[1,"string"]]]],[[0,"let"],[1,"a"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"A"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"B"]],[[0,"length"],[1,"A"]]],[1,"length"]]],[1,"A"]]],[[0,"let"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"B"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[1,"length"]]],[1,"B"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:fold"],[[0,"lambda"],[1,"acc"],[1,"pair"],[[0,"if"],[[0,">"],[[0,"car"],[1,"pair"]],[[0,"car"],[[0,"cdr"],[1,"pair"]]]],[2,0],[1,"acc"]]],[2,1]]]]]]],[[0,"let"],[1,"string:lesser?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"otherwise"],[[0,"string:equal?"],[1,"L"],[1,"R"]],[[0,"do"],[[0,"let"],[1,"A"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"L"],[1,"string"]]]],[[0,"let"],[1,"B"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"R"],[1,"string"]]]],[[0,"let"],[1,"a"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"A"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"B"]],[[0,"length"],[1,"A"]]],[1,"length"]]],[1,"A"]]],[[0,"let"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"B"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[1,"length"]]],[1,"B"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:fold"],[[0,"lambda"],[1,"acc"],[1,"pair"],[[0,"if"],[[0,"<"],[[0,"car"],[1,"pair"]],[[0,"car"],[[0,"cdr"],[1,"pair"]]]],[2,0],[1,"acc"]]],[2,1]]]]]]],[[0,"let"],[1,"string:equal?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"when"],[[0,"="],[[0,"length"],[1,"L"]],[[0,"length"],[1,"R"]]],[[0,"do"],[[0,"let"],[1,"a"],[[0,"cast:string->char-codes"],[1,"R"]]],[[0,"let"],[1,"b"],[[0,"cast:string->char-codes"],[1,"L"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:every?"],[[0,"lambda"],[1,"x"],[[0,"="],[[0,"car"],[1,"x"]],[[0,"car"],[[0,"cdr"],[1,"x"]]]]]]]]]]],[[0,"let"],[1,"string:trim-left"],[[0,"lambda"],[1,"str"],[[0,"do"],[[0,"let"],[1,"tr"],[[0,"array"],[2,1]]],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"and"],[[0,"car"],[1,"tr"]],[[0,"string:equal?"],[1,"b"],[2," "]]],[1,"a"],[[0,"do"],[[0,"when"],[[0,"car"],[1,"tr"]],[[0,"array:set!"],[1,"tr"],[2,0],[2,0]]],[[0,"string:merge"],[1,"a"],[1,"b"]]]]],[2,""]]]]]],[[0,"let"],[1,"string:trim-right"],[[0,"lambda"],[1,"str"],[[0,"do"],[[0,"let"],[1,"tr"],[[0,"array"],[2,1]]],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:reverse"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"and"],[[0,"car"],[1,"tr"]],[[0,"string:equal?"],[1,"b"],[2," "]]],[1,"a"],[[0,"do"],[[0,"when"],[[0,"car"],[1,"tr"]],[[0,"array:set!"],[1,"tr"],[2,0],[2,0]]],[[0,"string:merge"],[1,"b"],[1,"a"]]]]],[2,""]]]]]],[[0,"let"],[1,"string:trim"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"string:trim-left"]],[[0,"string:trim-right"]]]]],[[0,"let"],[1,"string:lines"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[2,"\n"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:words"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[2," "]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:separator"],[[0,"lambda"],[1,"str"],[1,"separator"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[1,"separator"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"new:set"],[[0,"lambda"],[[0,"array"],[],[],[],[]]]],[[0,"let"],[1,"new:array"],[[0,"safety"],[1,"lambda"],[1,"items"],[[0,"type"],[1,"items"],[1,"array"]]]],[[0,"let"],[1,"new:list"],[[0,"safety"],[1,"lambda"],[1,"value"],[[0,"array"],[],[1,"value"],[]]]],[[0,"let"],[1,"new:binary-tree"],[[0,"safety"],[1,"lambda"],[1,"value"],[[0,"do"],[[0,"let"],[1,"arr"],[]],[[0,"array:set!"],[1,"arr"],[2,0],[1,"value"]],[[0,"array:set!"],[1,"arr"],[2,1],[]],[[0,"array:set!"],[1,"arr"],[2,2],[]],[1,"arr"]]]],[[0,"let"],[1,"binary-tree:left"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,1]]]],[[0,"let"],[1,"binary-tree:right"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,2]]]],[[0,"let"],[1,"binary-tree:left!"],[[0,"safety"],[1,"lambda"],[1,"tree"],[1,"node"],[[0,"array:set!"],[1,"tree"],[2,1],[1,"node"]]]],[[0,"let"],[1,"binary-tree:right!"],[[0,"safety"],[1,"lambda"],[1,"tree"],[1,"node"],[[0,"array:set!"],[1,"tree"],[2,2],[1,"node"]]]],[[0,"let"],[1,"binary-tree:value"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"car"],[1,"node"]]]],[[0,"let"],[1,"set:index"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"prime-num"],[2,31]],[[0,"let"],[1,"key-arr"],[[0,"type"],[[0,"type"],[1,"key"],[1,"string"]],[1,"array"]]],[[0,"let"],[1,"total"],[[0,"array"],[2,0]]],[[0,"let*"],[1,"find-hash-index"],[[0,"lambda"],[1,"i"],[1,"bounds"],[[0,"do"],[[0,"let"],[1,"letter"],[[0,"array:get"],[1,"key-arr"],[1,"i"]]],[[0,"let"],[1,"value"],[[0,"-"],[[0,"type"],[1,"letter"],[1,"char-code"]],[2,96]]],[[0,"array:set!"],[1,"total"],[2,0],[[0,"math:euclidean-mod"],[[0,"+"],[[0,"*"],[[0,"car"],[1,"total"]],[1,"prime-num"]],[1,"value"]],[[0,"length"],[1,"table"]]]],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"find-hash-index"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"]],[[0,"car"],[1,"total"]]]]]],[[0,"find-hash-index"],[2,0],[[0,"if"],[[0,"<"],[[0,"-"],[[0,"length"],[1,"key-arr"]],[2,1]],[2,100]],[[0,"-"],[[0,"length"],[1,"key-arr"]],[2,1]],[2,100]]]]]],[[0,"let"],[1,"set:add!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[[0,"array"]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[1,"key"]],[[0,"if"],[[0,"="],[1,"index"],[2,-1]],[[0,"array:set!"],[1,"current"],[[0,"length"],[1,"current"]],[1,"entry"]],[[0,"array:set!"],[1,"current"],[1,"index"],[1,"entry"]]],[1,"table"]]]],[[0,"let"],[1,"set:remove!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[[0,"Array"]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[1,"key"]],[[0,"otherwise"],[[0,"="],[1,"index"],[2,-1]],[[0,"and"],[[0,"array:set!"],[1,"current"],[1,"index"],[[0,"array:get"],[1,"current"],[2,-1]]],[[0,"array:set!"],[1,"current"],[2,-1]]]],[1,"table"]]]],[[0,"let"],[1,"set:has?"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"and"],[[0,"array:in-bounds?"],[1,"table"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]]],[[0,"and"],[[0,"length"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]]],[[0,">="],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,0]]]]]],[[0,"let"],[1,"set:intersection"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:fold"],[[0,"lambda"],[1,"out"],[1,"element"],[[0,"do"],[[0,"when"],[[0,"set:has?"],[1,"a"],[1,"element"]],[[0,"set:add!"],[1,"out"],[1,"element"]]],[1,"out"]]],[[0,"array"],[],[],[],[],[]]]]]],[[0,"let"],[1,"set:difference"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:fold"],[[0,"lambda"],[1,"out"],[1,"element"],[[0,"do"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"b"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]],[1,"out"]]],[[0,"array"],[],[],[],[],[]]]]]],[[0,"let"],[1,"set:xor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"out"],[[0,"array"],[],[],[],[],[]]],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"b"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]]]]],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"a"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]]]]],[1,"out"]]]],[[0,"let"],[1,"set:union"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"out"],[[0,"array"],[],[],[],[],[]]],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[1,"out"]]]],[[0,"let"],[1,"set:empty!"],[[0,"lambda"],[1,"table"],[[0,"array:map"],[1,"table"],[1,"empty!"]]]],[[0,"let"],[1,"map:empty!"],[[0,"lambda"],[1,"table"],[[0,"array:map"],[1,"table"],[1,"empty!"]]]],[[0,"let"],[1,"map:set!"],[[0,"lambda"],[1,"table"],[1,"key"],[1,"value"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[[0,"car"],[1,"x"]],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[[0,"array"],[1,"key"],[1,"value"]]],[[0,"if"],[[0,"="],[1,"index"],[2,-1]],[[0,"array:set!"],[1,"current"],[[0,"length"],[1,"current"]],[1,"entry"]],[[0,"array:set!"],[1,"current"],[1,"index"],[1,"entry"]]],[1,"table"]]]],[[0,"let"],[1,"map:remove!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[[0,"car"],[1,"x"]],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"otherwise"],[[0,"="],[1,"index"],[2,-1]],[[0,"and"],[[0,"array:set!"],[1,"current"],[1,"index"],[[0,"array:get"],[1,"current"],[2,-1]]],[[0,"array:set!"],[1,"current"],[2,-1]]]],[1,"table"]]]],[[0,"let"],[1,"map:get"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"when"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"do"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"found"],[[0,"array:find"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"key"],[1,"string"]],[[0,"type"],[[0,"array:get"],[1,"x"],[2,0]],[1,"string"]]]]]],[[0,"when"],[[0,"length"],[1,"found"]],[[0,"array:get"],[1,"found"],[2,1]]]]]]]],[[0,"let"],[1,"map:has?"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"and"],[[0,"array:in-bounds?"],[1,"table"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]]],[[0,"and"],[[0,"length"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]]],[[0,">="],[[0,"array:find-index"],[[0,"car"],[1,"current"]],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,0]]]]]],[[0,"let"],[1,"list:prev!"],[[0,"safety"],[1,"lambda"],[1,"list"],[1,"node"],[[0,"array:set!"],[1,"list"],[2,0],[[0,"array:set!"],[1,"node"],[2,2],[1,"list"]]]]],[[0,"let"],[1,"list:next!"],[[0,"safety"],[1,"lambda"],[1,"list"],[1,"node"],[[0,"array:set!"],[1,"list"],[2,2],[[0,"array:set!"],[1,"node"],[2,0],[1,"list"]]]]],[[0,"let"],[1,"list:prev"],[[0,"safety"],[1,"lambda"],[1,"list"],[[0,"array:get"],[1,"list"],[2,0]]]],[[0,"let"],[1,"list:next"],[[0,"safety"],[1,"lambda"],[1,"list"],[[0,"array:get"],[1,"list"],[2,2]]]],[[0,"let"],[1,"list:value"],[[0,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,1]]]],[[0,"let"],[1,"var:def"],[[0,"safety"],[1,"lambda"],[1,"val"],[[0,"array"],[1,"val"]]]],[[0,"let"],[1,"var:get"],[[0,"safety"],[1,"lambda"],[1,"variable"],[[0,"car"],[1,"variable"]]]],[[0,"let"],[1,"var:set!"],[[0,"safety"],[1,"lambda"],[1,"variable"],[1,"value"],[[0,"array:set!"],[1,"variable"],[2,0],[1,"value"]]]],[[0,"let"],[1,"var:del!"],[[0,"safety"],[1,"lambda"],[1,"variable"],[[0,"array:set!"],[1,"variable"],[2,-1]]]],[[0,"let"],[1,"new:brray"],[[0,"lambda"],[[0,"array"],[[0,"array"],[]],[]]]],[[0,"let"],[1,"brray:offset-left"],[[0,"lambda"],[1,"q"],[[0,"*"],[[0,"-"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[2,1]],[2,-1]]]],[[0,"let"],[1,"brray:offset-right"],[[0,"lambda"],[1,"q"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]]]],[[0,"let"],[1,"brray:length"],[[0,"lambda"],[1,"q"],[[0,"+"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]],[2,-1]]]],[[0,"let"],[1,"brray:empty?"],[[0,"lambda"],[1,"q"],[[0,"not"],[[0,"brray:length"],[1,"q"]]]]],[[0,"let"],[1,"brray:empty!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"array:set!"],[1,"q"],[2,0],[[0,"array"],[]]],[[0,"array:set!"],[1,"q"],[2,1],[]],[1,"q"]]]],[[0,"let"],[1,"brray:get"],[[0,"lambda"],[1,"q"],[1,"offset"],[[0,"do"],[[0,"let"],[1,"offset-index"],[[0,"+"],[1,"offset"],[[0,"brray:offset-left"],[1,"q"]]]],[[0,"let"],[1,"index"],[[0,"if"],[[0,"<"],[1,"offset-index"],[2,0]],[[0,"*"],[1,"offset-index"],[2,-1]],[1,"offset-index"]]],[[0,"if"],[[0,">="],[1,"offset-index"],[2,0]],[[0,"array:get"],[[0,"array:get"],[1,"q"],[2,1]],[1,"index"]],[[0,"array:get"],[[0,"array:get"],[1,"q"],[2,0]],[1,"index"]]]]]],[[0,"let"],[1,"brray:set!"],[[0,"lambda"],[1,"q"],[1,"index"],[1,"value"],[[0,"do"],[[0,"let"],[1,"offset"],[[0,"+"],[1,"offset"],[[0,"brray:offset-left"],[1,"q"]]]],[[0,"if"],[[0,">="],[1,"offset"],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,1]],[1,"offset"],[1,"value"]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,0]],[[0,"*"],[1,"offset"],[2,-1]],[1,"value"]]],[1,"q"]]]],[[0,"let"],[1,"brray:add-to-left!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[[0,"let"],[1,"c"],[[0,"array:get"],[1,"q"],[2,0]]],[[0,"length"],[1,"c"]],[1,"item"]]]],[[0,"let"],[1,"brray:add-to-right!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[[0,"let"],[1,"c"],[[0,"array:get"],[1,"q"],[2,1]]],[[0,"length"],[1,"c"]],[1,"item"]]]],[[0,"let"],[1,"brray:remove-from-left!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"when"],[1,"len"],[[0,"cond"],[[0,"="],[1,"len"],[2,1]],[[0,"brray:empty!"],[1,"q"]],[[0,">"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,0]],[2,-1]]]]]]],[[0,"let"],[1,"brray:remove-from-right!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"when"],[1,"len"],[[0,"cond"],[[0,"="],[1,"len"],[2,1]],[[0,"brray:empty!"],[1,"q"]],[[0,">"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,1]],[2,-1]]]]]]],[[0,"let"],[1,"brray:iter"],[[0,"lambda"],[1,"q"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[[0,"brray:length"],[1,"q"]]]]]],[[0,"let"],[1,"brray:map"],[[0,"lambda"],[1,"q"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"result"],[[0,"new:brray"]]],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[1,"len"],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"result"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"result"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[1,"len"],[2,1]]],[1,"result"]]]],[[0,"let"],[1,"brray:balance?"],[[0,"lambda"],[1,"q"],[[0,"="],[[0,"+"],[[0,"brray:offset-right"],[1,"q"]],[[0,"brray:offset-left"],[1,"q"]]],[2,0]]]],[[0,"let"],[1,"brray:balance!"],[[0,"lambda"],[1,"q"],[[0,"if"],[[0,"brray:balance?"],[1,"q"]],[1,"q"],[[0,"do"],[[0,"let"],[1,"initial"],[[0,"cast:brray->array"],[1,"q"]]],[[0,"brray:empty!"],[1,"q"]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[[0,"length"],[1,"initial"]],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[[0,"length"],[1,"initial"]],[2,1]]],[1,"q"]]]]],[[0,"let"],[1,"brray:append!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[1,"item"]],[1,"q"]]]],[[0,"let"],[1,"brray:prepend!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[1,"item"]],[1,"q"]]]],[[0,"let"],[1,"brray:head!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-right"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:remove-from-right!"],[1,"q"]],[1,"q"]]]],[[0,"let"],[1,"brray:tail!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-left"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:remove-from-left!"],[1,"q"]],[1,"q"]]]],[[0,"let"],[1,"brray:first"],[[0,"lambda"],[1,"q"],[[0,"brray:get"],[1,"q"],[2,0]]]],[[0,"let"],[1,"brray:last"],[[0,"lambda"],[1,"q"],[[0,"brray:get"],[1,"q"],[[0,"-"],[[0,"brray:length"],[1,"q"]],[2,1]]]]],[[0,"let"],[1,"brray:pop-right!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"last"],[[0,"brray:last"],[1,"q"]]],[[0,"brray:head!"],[1,"q"]],[1,"last"]]]],[[0,"let"],[1,"brray:pop-left!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"first"],[[0,"brray:first"],[1,"q"]]],[[0,"brray:tail!"],[1,"q"]],[1,"first"]]]],[[0,"let"],[1,"brray:rotate-left!"],[[0,"lambda"],[1,"q"],[1,"n"],[[0,"do"],[[0,"let"],[1,"N"],[[0,"mod"],[1,"n"],[[0,"brray:length"],[1,"q"]]]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-left"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:add-to-right!"],[1,"q"],[[0,"brray:first"],[1,"q"]]],[[0,"brray:remove-from-left!"],[1,"q"]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[1,"N"]],[1,"q"]]]],[[0,"let"],[1,"brray:rotate-right!"],[[0,"lambda"],[1,"q"],[1,"n"],[[0,"do"],[[0,"let"],[1,"N"],[[0,"mod"],[1,"n"],[[0,"brray:length"],[1,"q"]]]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-right"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:add-to-left!"],[1,"q"],[[0,"brray:last"],[1,"q"]]],[[0,"brray:remove-from-right!"],[1,"q"]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[1,"N"]],[1,"q"]]]],[[0,"let"],[1,"brray:slice"],[[0,"lambda"],[1,"entity"],[1,"s"],[1,"e"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"entity"]]],[[0,"let"],[1,"start"],[[0,"if"],[[0,"<"],[1,"s"],[2,0]],[[0,"math:max"],[[0,"+"],[1,"len"],[1,"s"]],[2,0]],[[0,"math:min"],[1,"s"],[1,"len"]]]],[[0,"let"],[1,"end"],[[0,"if"],[[0,"<"],[1,"e"],[2,0]],[[0,"math:max"],[[0,"+"],[1,"len"],[1,"e"]],[2,0]],[[0,"math:min"],[1,"e"],[1,"len"]]]],[[0,"let"],[1,"slice"],[[0,"new:brray"]]],[[0,"let"],[1,"slice-len"],[[0,"math:max"],[[0,"-"],[1,"end"],[1,"start"]],[2,0]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[1,"slice-len"],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"slice"],[[0,"brray:get"],[1,"entity"],[[0,"+"],[1,"start"],[1,"index"]]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"slice"],[[0,"brray:get"],[1,"entity"],[[0,"+"],[1,"start"],[1,"index"]]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[1,"slice-len"],[2,1]]],[1,"slice"]]]],[[0,"let"],[1,"date:add-seconds"],[[0,"lambda"],[1,"date-time"],[1,"seconds"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"seconds"],[2,1000]]]]],[[0,"let"],[1,"date:add-minutes"],[[0,"lambda"],[1,"date-time"],[1,"minutes"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"minutes"],[2,1000],[2,60]]]]],[[0,"let"],[1,"date:add-hours"],[[0,"lambda"],[1,"date-time"],[1,"hours"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"hours"],[2,1000],[2,60],[2,60]]]]],[[0,"let"],[1,"date:add-days"],[[0,"lambda"],[1,"date-time"],[1,"days"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"days"],[2,1000],[2,60],[2,60],[2,24]]]]],[[0,"let"],[1,"date:add-months"],[[0,"lambda"],[1,"date-time"],[1,"months"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"months"],[2,1000],[2,60],[2,60],[2,24],[2,30]]]]],[[0,"let"],[1,"date:add-years"],[[0,"lambda"],[1,"date-time"],[1,"years"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"years"],[2,1000],[2,60],[2,60],[2,24],[2,365]]]]],[[0,"let"],[1,"date:sub-seconds"],[[0,"lambda"],[1,"date-time"],[1,"seconds"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"seconds"],[2,1000]]]]],[[0,"let"],[1,"date:sub-minutes"],[[0,"lambda"],[1,"date-time"],[1,"minutes"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"minutes"],[2,1000],[2,60]]]]],[[0,"let"],[1,"date:sub-hours"],[[0,"lambda"],[1,"date-time"],[1,"hours"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"hours"],[2,1000],[2,60],[2,60]]]]],[[0,"let"],[1,"date:sub-days"],[[0,"lambda"],[1,"date-time"],[1,"days"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"days"],[2,1000],[2,60],[2,60],[2,24]]]]],[[0,"let"],[1,"date:sub-months"],[[0,"lambda"],[1,"date-time"],[1,"months"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"months"],[2,1000],[2,60],[2,60],[2,24],[2,30]]]]],[[0,"let"],[1,"date:sub-years"],[[0,"lambda"],[1,"date-time"],[1,"years"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"years"],[2,1000],[2,60],[2,60],[2,24],[2,365]]]]]]
1
+ export default [[[0,"let"],[1,"math:E"],[2,2.718281828459045]],[[0,"let"],[1,"math:PI"],[2,3.141592653589793]],[[0,"let"],[1,"math:range"],[[0,"lambda"],[1,"start"],[1,"end"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<="],[1,"count"],[1,"end"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[1,"start"]]]]],[[0,"let"],[1,"math:sequence"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"end"],[[0,"length"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"out"]],[1,"end"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[2,0]]]]],[[0,"let"],[1,"math:sequence-n"],[[0,"lambda"],[1,"n"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"out"],[1,"count"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"out"]],[1,"n"]],[[0,"iterate"],[[0,"array:merge!"],[1,"out"],[[0,"array"],[1,"count"]]],[[0,"+"],[1,"count"],[2,1]]],[1,"out"]]]],[[0,"iterate"],[],[2,0]]]]],[[0,"let"],[1,"math:permutations"],[[0,"lambda"],[1,"xs"],[[0,"unless"],[[0,"length"],[1,"xs"]],[[0,"array"],[]],[[0,"|>"],[1,"xs"],[[0,"array:enumerated-map"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"|>"],[1,"xs"],[[0,"array:enumerated-exclude"],[[0,"lambda"],[1,"."],[1,"j"],[[0,"="],[1,"i"],[1,"j"]]]],[[0,"math:permutations"]],[[0,"array:map"],[[0,"lambda"],[1,"vs"],[[0,"array:merge"],[[0,"array"],[1,"x"]],[1,"vs"]]]]]]],[[0,"array:flat-one"]]]]]],[[0,"let"],[1,"math:greater?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,">"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:lesser?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"<"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:lesser-or-equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"<="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:greater-or-equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,">="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"="],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:addition"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"+"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:multiplication"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:division"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"/"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:subtraction"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:summation"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"+"],[1,"a"],[1,"b"]]],[[0,"+"]]]]],[[0,"let"],[1,"math:product"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"]]],[[0,"*"]]]]],[[0,"let"],[1,"math:maximum"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]],[[0,"car"],[1,"arr"]]]]],[[0,"let"],[1,"math:minimum"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"<"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]],[[0,"car"],[1,"arr"]]]]],[[0,"let"],[1,"math:max"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:min"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"<"],[1,"a"],[1,"b"]],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:increment"],[[0,"safety"],[1,"lambda"],[1,"i"],[[0,"+"],[1,"i"],[2,1]]]],[[0,"let"],[1,"math:floor"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"|"],[1,"n"],[2,0]]]],[[0,"let"],[1,"math:round"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"|"],[[0,"+"],[1,"n"],[2,0.5]],[2,0]]]],[[0,"let"],[1,"math:set-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"bit"],[[0,"|"],[1,"n"],[[0,"<<"],[2,1],[1,"bit"]]]]],[[0,"let"],[1,"math:clear-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"bit"],[[0,"&"],[1,"n"],[[0,"~"],[[0,"<<"],[2,1],[1,"bit"]]]]]],[[0,"let"],[1,"math:odd-bit?"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"="],[[0,"&"],[1,"n"],[2,1]],[2,1]]]],[[0,"let"],[1,"math:average-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">>"],[[0,"+"],[1,"a"],[1,"b"]],[2,1]]]],[[0,"let"],[1,"math:toggle-bit"],[[0,"safety"],[1,"lambda"],[1,"n"],[1,"a"],[1,"b"],[[0,"^"],[1,"a"],[1,"b"],[1,"n"]]]],[[0,"let"],[1,"math:same-sign-bit?"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">="],[[0,"^"],[1,"a"],[1,"b"]],[2,0]]]],[[0,"let"],[1,"math:max-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[[0,"&"],[[0,"-"],[1,"a"],[1,"b"]],[[0,">>"],[[0,"-"],[1,"a"],[1,"b"]],[2,31]]]]]],[[0,"let"],[1,"math:min-bit"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"-"],[1,"a"],[[0,"&"],[[0,"-"],[1,"a"],[1,"b"]],[[0,">>"],[[0,"-"],[1,"b"],[1,"a"]],[2,31]]]]]],[[0,"let"],[1,"math:modulo-bit"],[[0,"safety"],[1,"lambda"],[1,"numerator"],[1,"divisor"],[[0,"&"],[1,"numerator"],[[0,"-"],[1,"divisor"],[2,1]]]]],[[0,"let"],[1,"math:n-one-bit?"],[[0,"safety"],[1,"lambda"],[1,"N"],[1,"nth"],[[0,"type"],[[0,"&"],[1,"N"],[[0,"<<"],[2,1],[1,"nth"]]],[1,"boolean"]]]],[[0,"let"],[1,"math:square"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"*"],[1,"x"],[1,"x"]]]],[[0,"let"],[1,"math:power"],[[0,"lambda"],[1,"base"],[1,"exp"],[[0,"if"],[[0,"<"],[1,"exp"],[2,0]],[[0,"if"],[[0,"="],[1,"base"],[2,0]],[[0,"throw"],[2,"Attempting to divide by 0 in (math:power)"]],[[0,"/"],[[0,"*"],[1,"base"],[[0,"math:power"],[1,"base"],[[0,"-"],[[0,"*"],[1,"exp"],[2,-1]],[2,1]]]]]],[[0,"cond"],[[0,"="],[1,"exp"],[2,0]],[2,1],[[0,"="],[1,"exp"],[2,1]],[1,"base"],[[0,"*"]],[[0,"*"],[1,"base"],[[0,"math:power"],[1,"base"],[[0,"-"],[1,"exp"],[2,1]]]]]]]],[[0,"let"],[1,"math:greatest-common-divisor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let*"],[1,"gcd"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"="],[1,"b"],[2,0]],[1,"a"],[[0,"gcd"],[1,"b"],[[0,"mod"],[1,"a"],[1,"b"]]]]]],[[0,"gcd"],[1,"a"],[1,"b"]]]]],[[0,"let"],[1,"math:least-common-divisor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[1,"a"],[1,"b"],[[0,"/"],[[0,"math:greatest-common-divisor"],[1,"a"],[1,"b"]]]]]],[[0,"let"],[1,"math:sqrt"],[[0,"lambda"],[1,"x"],[[0,"do"],[[0,"let"],[1,"is-good-enough"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"<"],[[0,"math:abs"],[[0,"-"],[[0,"math:square"],[1,"g"]],[1,"x"]]],[2,0.01]]]],[[0,"let"],[1,"improve-guess"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"math:average"],[1,"g"],[[0,"*"],[1,"x"],[[0,"/"],[1,"g"]]]]]],[[0,"let*"],[1,"math:sqrt-iter"],[[0,"lambda"],[1,"g"],[1,"x"],[[0,"if"],[[0,"is-good-enough"],[1,"g"],[1,"x"]],[1,"g"],[[0,"math:sqrt-iter"],[[0,"improve-guess"],[1,"g"],[1,"x"]],[1,"x"]]]]],[[0,"math:sqrt-iter"],[2,1],[1,"x"]]]]],[[0,"let"],[1,"math:circumference"],[[0,"lambda"],[1,"radius"],[[0,"*"],[1,"math:PI"],[[0,"*"],[1,"radius"],[2,2]]]]],[[0,"let"],[1,"math:hypotenuse"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"math:sqrt"],[[0,"+"],[[0,"*"],[1,"a"],[1,"a"]],[[0,"*"],[1,"b"],[1,"b"]]]]]],[[0,"let"],[1,"math:abs"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"-"],[[0,"^"],[1,"n"],[[0,">>"],[1,"n"],[2,31]]],[[0,">>"],[1,"n"],[2,31]]]]],[[0,"let"],[1,"math:nth-digit"],[[0,"lambda"],[1,"digit"],[1,"n"],[[0,"|"],[[0,"mod"],[[0,"/"],[1,"digit"],[[0,"math:power"],[2,10],[[0,"-"],[1,"n"],[2,1]]]],[2,10]],[2,0.5]]]],[[0,"let"],[1,"math:normalize"],[[0,"safety"],[1,"lambda"],[1,"value"],[1,"math:min"],[1,"math:max"],[[0,"*"],[[0,"-"],[1,"value"],[1,"math:min"]],[[0,"/"],[[0,"-"],[1,"math:max"],[1,"math:min"]]]]]],[[0,"let"],[1,"math:linear-interpolation"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[1,"n"],[[0,"+"],[[0,"*"],[[0,"-"],[2,1],[1,"n"]],[1,"a"]],[[0,"*"],[1,"n"],[1,"b"]]]]],[[0,"let"],[1,"math:gauss-sum"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"*"],[1,"n"],[[0,"+"],[1,"n"],[2,1]],[2,0.5]]]],[[0,"let"],[1,"math:gauss-sum-sequance"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"*"],[[0,"+"],[1,"a"],[1,"b"]],[[0,"+"],[[0,"-"],[1,"b"],[1,"a"]],[2,1]],[2,0.5]]]],[[0,"let"],[1,"math:clamp"],[[0,"safety"],[1,"lambda"],[1,"x"],[1,"limit"],[[0,"if"],[[0,">"],[1,"x"],[1,"limit"]],[1,"limit"],[1,"x"]]]],[[0,"let"],[1,"math:odd?"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"="],[[0,"mod"],[1,"x"],[2,2]],[2,1]]]],[[0,"let"],[1,"math:even?"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"="],[[0,"mod"],[1,"x"],[2,2]],[2,0]]]],[[0,"let"],[1,"math:enumerated-odd?"],[[0,"safety"],[1,"lambda"],[1,"."],[1,"i"],[[0,"="],[[0,"mod"],[1,"i"],[2,2]],[2,1]]]],[[0,"let"],[1,"math:enumerated-even?"],[[0,"safety"],[1,"lambda"],[1,"."],[1,"i"],[[0,"="],[[0,"mod"],[1,"i"],[2,2]],[2,0]]]],[[0,"let"],[1,"math:sign"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"if"],[[0,"<"],[1,"n"],[2,0]],[2,-1],[2,1]]]],[[0,"let"],[1,"math:radians"],[[0,"lambda"],[1,"deg"],[[0,"*"],[1,"deg"],[1,"math:PI"],[[0,"/"],[2,180]]]]],[[0,"let"],[1,"math:average"],[[0,"safety"],[1,"lambda"],[1,"x"],[1,"y"],[[0,"*"],[[0,"+"],[1,"x"],[1,"y"]],[2,0.5]]]],[[0,"let"],[1,"math:euclidean-mod"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"mod"],[[0,"+"],[[0,"mod"],[1,"a"],[1,"b"]],[1,"b"]],[1,"b"]]]],[[0,"let"],[1,"math:euclidean-distance"],[[0,"lambda"],[1,"x1"],[1,"y1"],[1,"x2"],[1,"y2"],[[0,"do"],[[0,"let"],[1,"a"],[[0,"-"],[1,"x1"],[1,"x2"]]],[[0,"let"],[1,"b"],[[0,"-"],[1,"y1"],[1,"y2"]]],[[0,"math:sqrt"],[[0,"+"],[[0,"*"],[1,"a"],[1,"a"]],[[0,"*"],[1,"b"],[1,"b"]]]]]]],[[0,"let"],[1,"math:manhattan-distance"],[[0,"lambda"],[1,"x1"],[1,"y1"],[1,"x2"],[1,"y2"],[[0,"+"],[[0,"math:abs"],[[0,"-"],[1,"x2"],[1,"x1"]]],[[0,"math:abs"],[[0,"-"],[1,"y2"],[1,"y1"]]]]]],[[0,"let"],[1,"math:positive?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,">"],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:negative?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,"<"],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:zero?"],[[0,"safety"],[1,"lambda"],[1,"num"],[[0,"="],[1,"num"],[2,0]]]],[[0,"let"],[1,"math:divisible?"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,"="],[[0,"mod"],[1,"a"],[1,"b"]],[2,0]]]],[[0,"let"],[1,"math:prime?"],[[0,"lambda"],[1,"n"],[[0,"cond"],[[0,"="],[1,"n"],[2,1]],[2,0],[[0,"<"],[1,"n"],[2,0]],[2,0],[[0,"*"]],[[0,"do"],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"i"],[1,"end"],[[0,"do"],[[0,"let"],[1,"is-prime"],[[0,"not"],[[0,"="],[[0,"mod"],[1,"n"],[1,"i"]],[2,0]]]],[[0,"if"],[[0,"and"],[[0,"<="],[1,"i"],[1,"end"]],[1,"is-prime"]],[[0,"iter"],[[0,"+"],[1,"i"],[2,1]],[1,"end"]],[1,"is-prime"]]]]],[[0,"or"],[[0,"="],[1,"n"],[2,2]],[[0,"iter"],[2,2],[[0,"math:sqrt"],[1,"n"]]]]]]]],[[0,"let"],[1,"math:largest-power"],[[0,"safety"],[1,"lambda"],[1,"N"],[[0,"do"],[[0,"let"],[1,"N1"],[[0,"|"],[1,"N"],[[0,">>"],[1,"N"],[2,1]]]],[[0,"let"],[1,"N2"],[[0,"|"],[1,"N1"],[[0,">>"],[1,"N1"],[2,2]]]],[[0,"let"],[1,"N3"],[[0,"|"],[1,"N2"],[[0,">>"],[1,"N2"],[2,4]]]],[[0,"let"],[1,"N4"],[[0,"|"],[1,"N3"],[[0,">>"],[1,"N3"],[2,8]]]],[[0,">>"],[[0,"+"],[1,"N4"],[2,1]],[2,1]]]]],[[0,"let"],[1,"math:cartesian-product"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:fold"],[1,"a"],[[0,"lambda"],[1,"p"],[1,"x"],[[0,"array:merge!"],[1,"p"],[[0,"array:map"],[1,"b"],[[0,"lambda"],[1,"y"],[[0,"array"],[1,"x"],[1,"y"]]]]]],[]]]],[[0,"let*"],[1,"array:for"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"when"],[[0,"length"],[1,"arr"]],[[0,"do"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"array:for"],[[0,"cdr"],[1,"arr"]],[1,"callback"]]]]]],[[0,"let"],[1,"array:map"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"callback"],[[0,"car"],[1,"arr"]]]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:select"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:exclude"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"if"],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:fold"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[1,"initial"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"callback"],[1,"out"],[[0,"car"],[1,"arr"]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[1,"initial"]]]]],[[0,"let"],[1,"array:every?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"callback"],[[0,"car"],[1,"arr"]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]],[[0,"not"],[[0,"length"],[1,"arr"]]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:some?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]],[[0,"type"],[[0,"length"],[1,"arr"]],[1,"boolean"]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:find"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[[0,"car"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]]],[]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:has?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[[0,"when"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[2,1],[[0,"iterate"],[[0,"cdr"],[1,"arr"]]]]]]],[[0,"iterate"],[1,"arr"]]]]],[[0,"let"],[1,"array:reverse"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"array:merge!"],[[0,"array"],[[0,"car"],[1,"arr"]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[]]]]],[[0,"let"],[1,"array:append!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[1,"q"],[[0,"length"],[1,"q"]],[1,"item"]]]],[[0,"let"],[1,"array:tail!"],[[0,"lambda"],[1,"q"],[[0,"array:set!"],[1,"q"],[2,-1]]]],[[0,"let"],[1,"array:push!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"array:set!"],[1,"q"],[[0,"length"],[1,"q"]],[1,"item"]],[1,"item"]]]],[[0,"let"],[1,"array:pop!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"l"],[[0,"array:get"],[1,"q"],[2,-1]]],[[0,"array:set!"],[1,"q"],[2,-1]],[1,"l"]]]],[[0,"let"],[1,"array:unique"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[[0,"let"],[1,"sorted"],[[0,"array:sort"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"b"],[[0,">"],[1,"a"],[1,"b"]]]]],[[0,"array:zip"],[[0,"math:sequence"],[1,"sorted"]]],[[0,"array:select"],[[0,"lambda"],[1,"x"],[[0,"or"],[[0,"not"],[[0,"let"],[1,"index"],[[0,"car"],[[0,"cdr"],[1,"x"]]]]],[[0,"not"],[[0,"="],[[0,"array:get"],[1,"sorted"],[[0,"-"],[1,"index"],[2,1]]],[[0,"array:get"],[1,"sorted"],[1,"index"]]]]]]],[[0,"array:map"],[1,"car"]]]]],[[0,"let"],[1,"array:for-range"],[[0,"safety"],[1,"lambda"],[1,"start"],[1,"end"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[[0,"when"],[[0,"<"],[1,"i"],[1,"end"]],[[0,"do"],[[0,"callback"],[1,"i"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]]]]]]],[[0,"iterate"],[1,"start"]]]]],[[0,"let"],[1,"array:traverse"],[[0,"lambda"],[1,"x"],[1,"callback"],[[0,"if"],[[0,"atom?"],[1,"x"]],[[0,"callback"],[1,"x"]],[[0,"iterate"],[1,"x"],[[0,"lambda"],[1,"y"],[[0,"array:traverse"],[1,"y"],[1,"callback"]]]]]]],[[0,"let"],[1,"array:empty?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"not"],[[0,"length"],[1,"arr"]]]]],[[0,"let"],[1,"array:count-of"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"|>"],[1,"arr"],[[0,"array:select"],[1,"callback"]],[[0,"length"]]]]],[[0,"let"],[1,"array:empty!"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"do"],[[0,"array:set!"],[1,"arr"],[2,-1]],[[0,"iterate"]]],[1,"arr"]]]],[[0,"iterate"]]]]],[[0,"let"],[1,"array:in-bounds?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"index"],[[0,"and"],[[0,"<"],[1,"index"],[[0,"length"],[1,"arr"]]],[[0,">="],[1,"index"],[2,0]]]]],[[0,"let"],[1,"array:slice"],[[0,"lambda"],[1,"arr"],[1,"start"],[1,"end"],[[0,"do"],[[0,"let"],[1,"bounds"],[[0,"-"],[1,"end"],[1,"start"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"out"],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"array:get"],[1,"arr"],[[0,"+"],[1,"start"],[1,"i"]]]]]],[1,"out"]]]],[[0,"iterate"],[2,0],[]]]]],[[0,"let"],[1,"array:binary-search"],[[0,"lambda"],[1,"arr"],[1,"target"],[[0,"do"],[[0,"let*"],[1,"search"],[[0,"lambda"],[1,"arr"],[1,"target"],[1,"start"],[1,"end"],[[0,"do"],[[0,"when"],[[0,"<="],[1,"start"],[1,"end"]],[[0,"do"],[[0,"let"],[1,"index"],[[0,"math:floor"],[[0,"*"],[[0,"+"],[1,"start"],[1,"end"]],[2,0.5]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"index"]]],[[0,"if"],[[0,"="],[1,"target"],[1,"current"]],[1,"target"],[[0,"if"],[[0,">"],[1,"current"],[1,"target"]],[[0,"search"],[1,"arr"],[1,"target"],[1,"start"],[[0,"-"],[1,"index"],[2,1]]],[[0,"search"],[1,"arr"],[1,"target"],[[0,"+"],[1,"index"],[2,1]],[1,"end"]]]]]]]]],[[0,"search"],[1,"arr"],[1,"target"],[2,0],[[0,"length"],[1,"arr"]]]]]],[[0,"let"],[1,"array:zip"],[[0,"lambda"],[1,"A"],[1,"B"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"a"],[1,"b"],[1,"output"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"iterate"],[[0,"cdr"],[1,"a"]],[[0,"cdr"],[1,"b"]],[[0,"array:merge!"],[1,"output"],[[0,"array"],[[0,"array"],[[0,"car"],[1,"a"]],[[0,"car"],[1,"b"]]]]]],[1,"output"]]]],[[0,"iterate"],[1,"A"],[1,"B"],[]]]]],[[0,"let"],[1,"array:equal?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"or"],[[0,"and"],[[0,"number?"],[1,"a"]],[[0,"number?"],[1,"b"]],[[0,"="],[1,"a"],[1,"b"]]],[[0,"and"],[[0,"string?"],[1,"a"]],[[0,"string?"],[1,"b"]],[[0,"string:equal?"],[1,"a"],[1,"b"]]],[[0,"and"],[[0,"array?"],[1,"a"]],[[0,"="],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"not"],[[0,"array:some?"],[[0,"math:sequence"],[1,"a"]],[[0,"lambda"],[1,"i"],[[0,"not"],[[0,"array:equal?"],[[0,"array:get"],[1,"a"],[1,"i"]],[[0,"array:get"],[1,"b"],[1,"i"]]]]]]]]]]],[[0,"let"],[1,"array:join"],[[0,"lambda"],[1,"arr"],[1,"delim"],[[0,"array:fold"],[[0,"array:zip"],[1,"arr"],[[0,"math:sequence"],[1,"arr"]]],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[2,0]],[[0,"string:merge"],[1,"a"],[1,"delim"],[[0,"type"],[[0,"car"],[1,"b"]],[1,"string"]]],[[0,"type"],[[0,"car"],[1,"b"]],[1,"string"]]]],[2,""]]]],[[0,"let"],[1,"array:flat-one"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:merge!"],[1,"a"],[[0,"if"],[[0,"array?"],[1,"b"]],[1,"b"],[[0,"array"],[1,"b"]]]]],[]]]],[[0,"let"],[1,"array:flat"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"flatten"],[[0,"lambda"],[1,"item"],[[0,"if"],[[0,"and"],[[0,"array?"],[1,"item"]],[[0,"length"],[1,"item"]]],[[0,"array:fold"],[1,"item"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:merge!"],[1,"a"],[[0,"flatten"],[1,"b"]]]],[]],[[0,"array"],[1,"item"]]]]],[[0,"flatten"],[1,"arr"]]]]],[[0,"let"],[1,"array:sort"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"if"],[[0,"<="],[[0,"length"],[1,"arr"]],[2,1]],[1,"arr"],[[0,"do"],[[0,"let"],[1,"pivot"],[[0,"car"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"bounds"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"i"]]],[[0,"let"],[1,"predicate"],[[0,"callback"],[1,"current"],[1,"pivot"]]],[[0,"let"],[1,"left"],[[0,"if"],[[0,"="],[1,"predicate"],[2,0]],[[0,"array:merge"],[1,"a"],[[0,"array"],[1,"current"]]],[1,"a"]]],[[0,"let"],[1,"right"],[[0,"if"],[[0,"="],[1,"predicate"],[2,1]],[[0,"array:merge"],[1,"b"],[[0,"array"],[1,"current"]]],[1,"b"]]],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"],[1,"left"],[1,"right"]],[[0,"array"],[1,"left"],[1,"right"]]]]]],[[0,"let"],[1,"sorted"],[[0,"iterate"],[2,1],[[0,"-"],[[0,"length"],[1,"arr"]],[2,1]],[],[]]],[[0,"let"],[1,"left"],[[0,"car"],[1,"sorted"]]],[[0,"let"],[1,"right"],[[0,"car"],[[0,"cdr"],[1,"sorted"]]]],[[0,"array:merge"],[[0,"array:sort"],[1,"left"],[1,"callback"]],[[0,"array"],[1,"pivot"]],[[0,"array:sort"],[1,"right"],[1,"callback"]]]]]]]],[[0,"let"],[1,"array:sorted-ascending?"],[[0,"lambda"],[1,"arr"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,">="],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:sorted-descending?"],[[0,"lambda"],[1,"arr"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,"<="],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:sorted-by?"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"array:enumerated-every?"],[1,"arr"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"or"],[[0,"="],[1,"i"],[2,0]],[[0,"callback"],[1,"x"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]]]]]]],[[0,"let"],[1,"array:set"],[[0,"lambda"],[1,"arr"],[1,"index"],[1,"item"],[[0,"array:set!"],[[0,"type"],[1,"arr"],[1,"array"]],[1,"index"],[1,"item"]]]],[[0,"let"],[1,"array:adjacent-difference"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"length"],[1,"arr"]]],[[0,"unless"],[[0,"="],[1,"len"],[2,1]],[[0,"do"],[[0,"array"],[[0,"car"],[1,"arr"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[1,"result"],[[0,"if"],[[0,"<"],[1,"i"],[1,"len"]],[[0,"do"],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]],[[0,"array:set!"],[1,"result"],[1,"i"],[[0,"callback"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]],[[0,"array:get"],[1,"arr"],[1,"i"]]]]]],[1,"result"]]]],[[0,"iterate"],[2,1],[1,"arr"]]],[1,"arr"]]]]],[[0,"let"],[1,"array:adjacent-find"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"length"],[1,"arr"]]],[[0,"otherwise"],[[0,"="],[1,"len"],[2,1]],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"i"],[[0,"if"],[[0,"<"],[1,"i"],[1,"len"]],[[0,"if"],[[0,"callback"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"arr"],[[0,"-"],[1,"i"],[2,1]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"arr"],[1,"i"]]]],[1,"prev"],[[0,"iterate"],[[0,"+"],[1,"i"],[2,1]]]],[]]]],[[0,"iterate"],[2,1]]]]]]],[[0,"let"],[1,"array:adjacent"],[[0,"lambda"],[1,"arr"],[1,"directions"],[1,"y"],[1,"x"],[1,"callback"],[[0,"array:for"],[1,"directions"],[[0,"lambda"],[1,"dir"],[[0,"do"],[[0,"let"],[1,"dy"],[[0,"+"],[[0,"car"],[1,"dir"]],[1,"y"]]],[[0,"let"],[1,"dx"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"dir"]]],[1,"x"]]],[[0,"when"],[[0,"and"],[[0,"array:in-bounds?"],[1,"arr"],[1,"dy"]],[[0,"array:in-bounds?"],[[0,"array:get"],[1,"arr"],[1,"dy"]],[1,"dx"]]],[[0,"callback"],[[0,"array:get"],[[0,"array:get"],[1,"arr"],[1,"dy"]],[1,"dx"]],[1,"dir"]]]]]]]],[[0,"let"],[1,"array:partition"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"array:fold"],[[0,"array:zip"],[1,"arr"],[[0,"math:sequence"],[1,"arr"]]],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"x"],[[0,"car"],[1,"b"]]],[[0,"let"],[1,"i"],[[0,"car"],[[0,"cdr"],[1,"b"]]]],[[0,"if"],[[0,"mod"],[1,"i"],[1,"n"]],[[0,"array:set!"],[[0,"let"],[1,"last-a"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"length"],[1,"last-a"]],[1,"x"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[[0,"do"],[[0,"let"],[1,"mut-arr"],[]],[[0,"array:set!"],[1,"mut-arr"],[[0,"length"],[1,"mut-arr"]],[1,"x"]]]]],[1,"a"]]],[]]]],[[0,"let"],[1,"cast:array->set"],[[0,"lambda"],[1,"arr"],[[0,"do"],[[0,"let"],[1,"s"],[[0,"array"],[],[],[],[]]],[[0,"array:for"],[1,"arr"],[[0,"lambda"],[1,"x"],[[0,"set:add!"],[1,"s"],[1,"x"]]]],[1,"s"]]]],[[0,"let"],[1,"cast:string->chars"],[[0,"safety"],[1,"lambda"],[1,"str"],[[0,"type"],[1,"str"],[1,"array"]]]],[[0,"let"],[1,"cast:chars->string"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"a"],[1,"x"],[[0,"string:merge"],[1,"a"],[[0,"type"],[1,"x"],[1,"string"]]]],[2,""]]]],[[0,"let"],[1,"cast:string->number"],[[0,"safety"],[1,"lambda"],[1,"str"],[[0,"type"],[1,"str"],[1,"number"]]]],[[0,"let"],[1,"cast:number->string"],[[0,"safety"],[1,"lambda"],[1,"n"],[[0,"type"],[1,"n"],[1,"string"]]]],[[0,"let"],[1,"cast:strings->numbers"],[[0,"lambda"],[1,"arr"],[[0,"array:map"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"number"]]]]]],[[0,"let"],[1,"cast:numbers->strings"],[[0,"lambda"],[1,"arr"],[[0,"array:map"],[1,"arr"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"string"]]]]]],[[0,"let"],[1,"cast:string->char-codes"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char-code"]]]]]]],[[0,"let"],[1,"cast:chars->char-codes"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char-code"]]]]]]],[[0,"let"],[1,"cast:chars->numbers"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"number"]]]]]]],[[0,"let"],[1,"cast:char->number"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"number"]]]],[[0,"let"],[1,"cast:char->char-code"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"char-code"]]]],[[0,"let"],[1,"cast:char-code->char"],[[0,"safety"],[1,"lambda"],[1,"ch"],[[0,"type"],[1,"ch"],[1,"char"]]]],[[0,"let"],[1,"cast:char-codes->chars"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char"]]]]]]],[[0,"let"],[1,"cast:char-codes->string"],[[0,"lambda"],[1,"arr"],[[0,"|>"],[1,"arr"],[[0,"array:map"],[[0,"safety"],[1,"lambda"],[1,"x"],[[0,"type"],[1,"x"],[1,"char"]]]],[[0,"cast:chars->string"]]]]],[[0,"let"],[1,"cast:table->array"],[[0,"lambda"],[1,"set"],[[0,"array:select"],[[0,"array:flat"],[1,"set"]],[1,"atom?"]]]],[[0,"let"],[1,"cast:map->string"],[[0,"lambda"],[1,"table"],[[0,"|>"],[1,"table"],[[0,"array:select"],[1,"length"]],[[0,"array:flat-one"]],[[0,"array:map"],[[0,"lambda"],[1,"y"],[[0,"array:join"],[1,"y"],[2," -> "]]]],[[0,"array:join"],[2,"\n"]]]]],[[0,"let"],[1,"cast:array->brray"],[[0,"lambda"],[1,"initial"],[[0,"do"],[[0,"let"],[1,"q"],[[0,"new:brray"]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[[0,"length"],[1,"initial"]],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[[0,"length"],[1,"initial"]],[2,1]]],[1,"q"]]]],[[0,"let"],[1,"cast:brray->array"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"out"],[]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"array:set!"],[1,"out"],[[0,"length"],[1,"out"]],[[0,"brray:get"],[1,"q"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[[0,"-"],[[0,"brray:length"],[1,"q"]],[2,1]]],[1,"out"]]]],[[0,"let"],[1,"string:split"],[[0,"lambda"],[1,"str"],[1,"delim"],[[0,"do"],[[0,"let"],[1,"locals"],[]],[[0,"let"],[1,"delim-arr"],[[0,"type"],[1,"delim"],[1,"array"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[1,"delim-arr"]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[[0,"type"],[1,"str"],[1,"array"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[[0,"length"],[1,"delim-arr"]]],[[0,"array:set!"],[1,"locals"],[[0,"length"],[1,"locals"]],[2,""]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"result"],[1,"i"],[1,"bounds"],[[0,"if"],[[0,"<"],[[0,"if"],[[0,"array:every?"],[[0,"array:zip"],[[0,"array:get"],[1,"locals"],[2,0]],[[0,"math:sequence"],[1,"locals"]]],[[0,"lambda"],[1,"item"],[[0,"do"],[[0,"let"],[1,"y"],[[0,"car"],[1,"item"]]],[[0,"let"],[1,"j"],[[0,"car"],[[0,"cdr"],[1,"item"]]]],[[0,"or"],[[0,"<="],[[0,"length"],[[0,"array:get"],[1,"locals"],[2,1]]],[[0,"+"],[1,"i"],[1,"j"]]],[[0,"="],[[0,"type"],[[0,"array:get"],[[0,"array:get"],[1,"locals"],[2,1]],[[0,"+"],[1,"i"],[1,"j"]]],[1,"char-code"]],[[0,"type"],[1,"y"],[1,"char-code"]]]]]]],[[0,"do"],[[0,"array:set!"],[1,"result"],[[0,"length"],[1,"result"]],[[0,"array:get"],[1,"locals"],[2,3]]],[[0,"array:set!"],[1,"locals"],[2,3],[2,""]],[[0,"+"],[1,"i"],[[0,"array:get"],[1,"locals"],[2,2]],[2,-1]]],[[0,"do"],[[0,"array:set!"],[1,"locals"],[2,3],[[0,"string:merge"],[[0,"array:get"],[1,"locals"],[2,3]],[[0,"array:get"],[[0,"array:get"],[1,"locals"],[2,1]],[1,"i"]]]],[1,"i"]]],[1,"bounds"]],[[0,"iterate"],[1,"result"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"]],[1,"result"]]]],[[0,"array:set!"],[[0,"let"],[1,"iteration-result"],[[0,"iterate"],[],[2,0],[[0,"-"],[[0,"length"],[[0,"array:get"],[1,"locals"],[2,1]]],[2,1]]]],[[0,"length"],[1,"iteration-result"]],[[0,"array:get"],[1,"locals"],[2,3]]]]]],[[0,"let"],[1,"array:shallow-copy"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[1,"b"]]],[]]]],[[0,"let"],[1,"array:deep-copy"],[[0,"lambda"],[1,"arr"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[[0,"if"],[[0,"array?"],[1,"b"]],[[0,"array:deep-copy"],[1,"b"]],[1,"b"]]]],[]]]],[[0,"let"],[1,"array:merge!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"array:for"],[1,"b"],[[0,"lambda"],[1,"x"],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[1,"x"]]]],[1,"a"]]]],[[0,"let"],[1,"array:swap-remove!"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"do"],[[0,"array:set!"],[1,"arr"],[1,"i"],[[0,"array:get"],[1,"arr"],[[0,"-"],[[0,"length"],[1,"arr"]],[2,1]]]],[[0,"array:set!"],[1,"arr"],[2,-1]]]]],[[0,"let"],[1,"array:swap!"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"j"],[[0,"do"],[[0,"let"],[1,"temp"],[[0,"array:get"],[1,"arr"],[1,"i"]]],[[0,"array:set!"],[1,"arr"],[1,"i"],[[0,"array:get"],[1,"arr"],[1,"j"]]],[[0,"array:set!"],[1,"arr"],[1,"j"],[1,"temp"]]]]],[[0,"let"],[1,"array:index-of"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"item"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"="],[[0,"car"],[1,"arr"]],[1,"item"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerate"],[[0,"lambda"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]],[1,"arr"]]]],[[0,"let"],[1,"array:enumerated-map"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-select"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-exclude"],[[0,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"if"],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]],[[0,"array:merge!"],[1,"out"],[[0,"array"],[[0,"car"],[1,"arr"]]]],[1,"out"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[]]]]],[[0,"let"],[1,"array:enumerated-fold"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[1,"initial"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[1,"out"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]],[[0,"callback"],[1,"out"],[[0,"car"],[1,"arr"]],[1,"i"]]],[1,"out"]]]],[[0,"iterate"],[1,"arr"],[2,0],[1,"initial"]]]]],[[0,"let"],[1,"array:enumerated-find"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[[0,"car"],[1,"arr"]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-find-index"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-every?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]],[[0,"not"],[[0,"length"],[1,"arr"]]]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:enumerated-some?"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"and"],[[0,"length"],[1,"arr"]],[[0,"not"],[[0,"callback"],[[0,"car"],[1,"arr"]],[1,"i"]]]],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]],[[0,"type"],[[0,"length"],[1,"arr"]],[1,"boolean"]]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:find-index"],[[0,"safety"],[1,"lambda"],[1,"arr"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"callback"],[[0,"car"],[1,"arr"]]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"arr"],[2,0]]]]],[[0,"let"],[1,"array:remove"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"array:fold"],[1,"arr"],[[0,"lambda"],[1,"a"],[1,"x"],[[0,"do"],[[0,"unless"],[[0,"="],[1,"x"],[1,"i"]],[[0,"array:merge!"],[1,"a"],[[0,"array"],[1,"x"]]],[1,"a"]]]],[]]]],[[0,"let"],[1,"array:pad-right"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge"],[1,"b"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]]],[[0,"array:merge"],[1,"a"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]]]]]],[[0,"let"],[1,"array:pad-left"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]],[1,"b"]],[[0,"array:merge"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]],[1,"a"]]]]],[[0,"let"],[1,"array:pad-right!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge!"],[1,"b"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]]],[[0,"array:merge!"],[1,"a"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]]]]]],[[0,"let"],[1,"array:pad-left!"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[[0,"array:merge!"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"a"]],[[0,"length"],[1,"b"]]],[1,"length"]],[1,"b"]],[[0,"array:merge!"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"b"]],[[0,"length"],[1,"a"]]],[1,"length"]],[1,"a"]]]]],[[0,"let"],[1,"array:rotate-right"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"|>"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"mod"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[1,"n"]],[[0,"length"],[1,"arr"]]],[[0,"car"],[1,"b"]]]],[[0,"array"],[[0,"length"],[1,"arr"]],[1,"length"]]]]]],[[0,"let"],[1,"array:rotate-left"],[[0,"lambda"],[1,"arr"],[1,"n"],[[0,"|>"],[1,"arr"],[[0,"array:zip"],[[0,"math:sequence"],[1,"arr"]]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"array:set!"],[1,"a"],[[0,"mod"],[[0,"+"],[[0,"car"],[[0,"cdr"],[1,"b"]]],[[0,"-"],[[0,"length"],[1,"arr"]],[1,"n"]]],[[0,"length"],[1,"arr"]]],[[0,"car"],[1,"b"]]]],[[0,"array"],[[0,"length"],[1,"arr"]],[1,"length"]]]]]],[[0,"let"],[1,"array:first"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"array:get"],[1,"arr"],[2,0]]]],[[0,"let"],[1,"array:last"],[[0,"safety"],[1,"lambda"],[1,"arr"],[[0,"array:get"],[1,"arr"],[2,-1]]]],[[0,"let"],[1,"string:index-of-char"],[[0,"lambda"],[1,"str"],[1,"character"],[[0,"do"],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"string:equal?"],[[0,"car"],[1,"arr"]],[1,"character"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[[0,"type"],[1,"str"],[1,"array"]],[2,0]]]]],[[0,"let"],[1,"string:match"],[[0,"lambda"],[1,"str"],[1,"word"],[[0,"do"],[[0,"let"],[1,"string-arr"],[[0,"type"],[1,"str"],[1,"array"]]],[[0,"let*"],[1,"iterate"],[[0,"lambda"],[1,"arr"],[1,"i"],[[0,"if"],[[0,"length"],[1,"arr"]],[[0,"if"],[[0,"string:equal?"],[[0,"|>"],[1,"string-arr"],[[0,"array:slice"],[1,"i"],[[0,"+"],[1,"i"],[[0,"length"],[1,"word"]]]],[[0,"array:join"],[2,""]]],[1,"word"]],[1,"i"],[[0,"iterate"],[[0,"cdr"],[1,"arr"]],[[0,"+"],[1,"i"],[2,1]]]],[2,-1]]]],[[0,"iterate"],[1,"toArr"],[2,0]]]]],[[0,"let"],[1,"string:greater?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"otherwise"],[[0,"string:equal?"],[1,"L"],[1,"R"]],[[0,"do"],[[0,"let"],[1,"A"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"L"],[1,"string"]]]],[[0,"let"],[1,"B"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"R"],[1,"string"]]]],[[0,"let"],[1,"a"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"A"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"B"]],[[0,"length"],[1,"A"]]],[1,"length"]]],[1,"A"]]],[[0,"let"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"B"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[1,"length"]]],[1,"B"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:fold"],[[0,"lambda"],[1,"acc"],[1,"pair"],[[0,"if"],[[0,">"],[[0,"car"],[1,"pair"]],[[0,"car"],[[0,"cdr"],[1,"pair"]]]],[2,0],[1,"acc"]]],[2,1]]]]]]],[[0,"let"],[1,"string:lesser?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"otherwise"],[[0,"string:equal?"],[1,"L"],[1,"R"]],[[0,"do"],[[0,"let"],[1,"A"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"L"],[1,"string"]]]],[[0,"let"],[1,"B"],[[0,"cast:string->char-codes"],[[0,"type"],[1,"R"],[1,"string"]]]],[[0,"let"],[1,"a"],[[0,"if"],[[0,"<"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"A"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"B"]],[[0,"length"],[1,"A"]]],[1,"length"]]],[1,"A"]]],[[0,"let"],[1,"b"],[[0,"if"],[[0,">"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[[0,"array:merge!"],[1,"B"],[[0,"array"],[[0,"-"],[[0,"length"],[1,"A"]],[[0,"length"],[1,"B"]]],[1,"length"]]],[1,"B"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:fold"],[[0,"lambda"],[1,"acc"],[1,"pair"],[[0,"if"],[[0,"<"],[[0,"car"],[1,"pair"]],[[0,"car"],[[0,"cdr"],[1,"pair"]]]],[2,0],[1,"acc"]]],[2,1]]]]]]],[[0,"let"],[1,"string:equal?"],[[0,"lambda"],[1,"L"],[1,"R"],[[0,"when"],[[0,"="],[[0,"length"],[1,"L"]],[[0,"length"],[1,"R"]]],[[0,"do"],[[0,"let"],[1,"a"],[[0,"cast:string->char-codes"],[1,"R"]]],[[0,"let"],[1,"b"],[[0,"cast:string->char-codes"],[1,"L"]]],[[0,"|>"],[1,"a"],[[0,"array:zip"],[1,"b"]],[[0,"array:every?"],[[0,"lambda"],[1,"x"],[[0,"="],[[0,"car"],[1,"x"]],[[0,"car"],[[0,"cdr"],[1,"x"]]]]]]]]]]],[[0,"let"],[1,"string:trim-left"],[[0,"lambda"],[1,"str"],[[0,"do"],[[0,"let"],[1,"tr"],[[0,"array"],[2,1]]],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"and"],[[0,"car"],[1,"tr"]],[[0,"string:equal?"],[1,"b"],[2," "]]],[1,"a"],[[0,"do"],[[0,"when"],[[0,"car"],[1,"tr"]],[[0,"array:set!"],[1,"tr"],[2,0],[2,0]]],[[0,"string:merge"],[1,"a"],[1,"b"]]]]],[2,""]]]]]],[[0,"let"],[1,"string:trim-right"],[[0,"lambda"],[1,"str"],[[0,"do"],[[0,"let"],[1,"tr"],[[0,"array"],[2,1]]],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:reverse"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"if"],[[0,"and"],[[0,"car"],[1,"tr"]],[[0,"string:equal?"],[1,"b"],[2," "]]],[1,"a"],[[0,"do"],[[0,"when"],[[0,"car"],[1,"tr"]],[[0,"array:set!"],[1,"tr"],[2,0],[2,0]]],[[0,"string:merge"],[1,"b"],[1,"a"]]]]],[2,""]]]]]],[[0,"let"],[1,"string:trim"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"string:trim-left"]],[[0,"string:trim-right"]]]]],[[0,"let"],[1,"string:lines"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[2,"\n"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:words"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[2," "]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:commas"],[[0,"lambda"],[1,"str"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[2,","]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:separator"],[[0,"lambda"],[1,"str"],[1,"separator"],[[0,"|>"],[1,"str"],[[0,"type"],[1,"array"]],[[0,"array:fold"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"prev"],[[0,"array:get"],[1,"a"],[2,-1]]],[[0,"if"],[[0,"string:equal?"],[1,"b"],[1,"separator"]],[[0,"array:set!"],[1,"a"],[[0,"length"],[1,"a"]],[]],[[0,"array:set!"],[1,"prev"],[[0,"length"],[1,"prev"]],[1,"b"]]],[1,"a"]]],[[0,"array"],[]]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[1,"x"],[2,""]]]]]]],[[0,"let"],[1,"string:append"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"string:merge"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"string:prepend"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"string:merge"],[1,"b"],[1,"a"]]]],[[0,"let"],[1,"new:set"],[[0,"lambda"],[[0,"array"],[],[],[],[]]]],[[0,"let"],[1,"new:array"],[[0,"safety"],[1,"lambda"],[1,"items"],[[0,"type"],[1,"items"],[1,"array"]]]],[[0,"let"],[1,"new:list"],[[0,"safety"],[1,"lambda"],[1,"value"],[[0,"array"],[],[1,"value"],[]]]],[[0,"let"],[1,"new:binary-tree"],[[0,"safety"],[1,"lambda"],[1,"value"],[[0,"do"],[[0,"let"],[1,"arr"],[]],[[0,"array:set!"],[1,"arr"],[2,0],[1,"value"]],[[0,"array:set!"],[1,"arr"],[2,1],[]],[[0,"array:set!"],[1,"arr"],[2,2],[]],[1,"arr"]]]],[[0,"let"],[1,"binary-tree:left"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,1]]]],[[0,"let"],[1,"binary-tree:right"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,2]]]],[[0,"let"],[1,"binary-tree:left!"],[[0,"safety"],[1,"lambda"],[1,"tree"],[1,"node"],[[0,"array:set!"],[1,"tree"],[2,1],[1,"node"]]]],[[0,"let"],[1,"binary-tree:right!"],[[0,"safety"],[1,"lambda"],[1,"tree"],[1,"node"],[[0,"array:set!"],[1,"tree"],[2,2],[1,"node"]]]],[[0,"let"],[1,"binary-tree:value"],[[0,"safety"],[1,"lambda"],[1,"node"],[[0,"car"],[1,"node"]]]],[[0,"let"],[1,"set:index"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"prime-num"],[2,31]],[[0,"let"],[1,"key-arr"],[[0,"type"],[[0,"type"],[1,"key"],[1,"string"]],[1,"array"]]],[[0,"let"],[1,"total"],[[0,"array"],[2,0]]],[[0,"let*"],[1,"find-hash-index"],[[0,"lambda"],[1,"i"],[1,"bounds"],[[0,"do"],[[0,"let"],[1,"letter"],[[0,"array:get"],[1,"key-arr"],[1,"i"]]],[[0,"let"],[1,"value"],[[0,"-"],[[0,"type"],[1,"letter"],[1,"char-code"]],[2,96]]],[[0,"array:set!"],[1,"total"],[2,0],[[0,"math:euclidean-mod"],[[0,"+"],[[0,"*"],[[0,"car"],[1,"total"]],[1,"prime-num"]],[1,"value"]],[[0,"length"],[1,"table"]]]],[[0,"if"],[[0,"<"],[1,"i"],[1,"bounds"]],[[0,"find-hash-index"],[[0,"+"],[1,"i"],[2,1]],[1,"bounds"]],[[0,"car"],[1,"total"]]]]]],[[0,"find-hash-index"],[2,0],[[0,"if"],[[0,"<"],[[0,"-"],[[0,"length"],[1,"key-arr"]],[2,1]],[2,100]],[[0,"-"],[[0,"length"],[1,"key-arr"]],[2,1]],[2,100]]]]]],[[0,"let"],[1,"set:add!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[[0,"array"]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[1,"key"]],[[0,"if"],[[0,"="],[1,"index"],[2,-1]],[[0,"array:set!"],[1,"current"],[[0,"length"],[1,"current"]],[1,"entry"]],[[0,"array:set!"],[1,"current"],[1,"index"],[1,"entry"]]],[1,"table"]]]],[[0,"let"],[1,"set:remove!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[[0,"Array"]]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[1,"key"]],[[0,"otherwise"],[[0,"="],[1,"index"],[2,-1]],[[0,"and"],[[0,"array:set!"],[1,"current"],[1,"index"],[[0,"array:get"],[1,"current"],[2,-1]]],[[0,"array:set!"],[1,"current"],[2,-1]]]],[1,"table"]]]],[[0,"let"],[1,"set:has?"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"and"],[[0,"array:in-bounds?"],[1,"table"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]]],[[0,"and"],[[0,"length"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]]],[[0,">="],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,0]]]]]],[[0,"let"],[1,"set:intersection"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:fold"],[[0,"lambda"],[1,"out"],[1,"element"],[[0,"do"],[[0,"when"],[[0,"set:has?"],[1,"a"],[1,"element"]],[[0,"set:add!"],[1,"out"],[1,"element"]]],[1,"out"]]],[[0,"array"],[],[],[],[],[]]]]]],[[0,"let"],[1,"set:difference"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:fold"],[[0,"lambda"],[1,"out"],[1,"element"],[[0,"do"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"b"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]],[1,"out"]]],[[0,"array"],[],[],[],[],[]]]]]],[[0,"let"],[1,"set:xor"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"out"],[[0,"array"],[],[],[],[],[]]],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"b"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]]]]],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"when"],[[0,"not"],[[0,"set:has?"],[1,"a"],[1,"element"]]],[[0,"set:add!"],[1,"out"],[1,"element"]]]]]],[1,"out"]]]],[[0,"let"],[1,"set:union"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"do"],[[0,"let"],[1,"out"],[[0,"array"],[],[],[],[],[]]],[[0,"|>"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[[0,"|>"],[1,"b"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[1,"out"]]]],[[0,"let"],[1,"set:empty!"],[[0,"lambda"],[1,"table"],[[0,"array:map"],[1,"table"],[1,"empty!"]]]],[[0,"let"],[1,"map:empty!"],[[0,"lambda"],[1,"table"],[[0,"array:map"],[1,"table"],[1,"empty!"]]]],[[0,"let"],[1,"map:set!"],[[0,"lambda"],[1,"table"],[1,"key"],[1,"value"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[[0,"car"],[1,"x"]],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"let"],[1,"entry"],[[0,"array"],[1,"key"],[1,"value"]]],[[0,"if"],[[0,"="],[1,"index"],[2,-1]],[[0,"array:set!"],[1,"current"],[[0,"length"],[1,"current"]],[1,"entry"]],[[0,"array:set!"],[1,"current"],[1,"index"],[1,"entry"]]],[1,"table"]]]],[[0,"let"],[1,"map:remove!"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"otherwise"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"array:set!"],[1,"table"],[1,"idx"],[]]],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"len"],[[0,"length"],[1,"current"]]],[[0,"let"],[1,"index"],[[0,"if"],[1,"len"],[[0,"array:find-index"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[[0,"car"],[1,"x"]],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,-1]]],[[0,"otherwise"],[[0,"="],[1,"index"],[2,-1]],[[0,"and"],[[0,"array:set!"],[1,"current"],[1,"index"],[[0,"array:get"],[1,"current"],[2,-1]]],[[0,"array:set!"],[1,"current"],[2,-1]]]],[1,"table"]]]],[[0,"let"],[1,"map:get"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"do"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]],[[0,"when"],[[0,"array:in-bounds?"],[1,"table"],[1,"idx"]],[[0,"do"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]],[[0,"let"],[1,"found"],[[0,"array:find"],[1,"current"],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"key"],[1,"string"]],[[0,"type"],[[0,"array:get"],[1,"x"],[2,0]],[1,"string"]]]]]],[[0,"when"],[[0,"length"],[1,"found"]],[[0,"array:get"],[1,"found"],[2,1]]]]]]]],[[0,"let"],[1,"map:has?"],[[0,"lambda"],[1,"table"],[1,"key"],[[0,"and"],[[0,"array:in-bounds?"],[1,"table"],[[0,"let"],[1,"idx"],[[0,"set:index"],[1,"table"],[1,"key"]]]],[[0,"and"],[[0,"length"],[[0,"let"],[1,"current"],[[0,"array:get"],[1,"table"],[1,"idx"]]]],[[0,">="],[[0,"array:find-index"],[[0,"car"],[1,"current"]],[[0,"lambda"],[1,"x"],[[0,"string:equal?"],[[0,"type"],[1,"x"],[1,"string"]],[[0,"type"],[1,"key"],[1,"string"]]]]],[2,0]]]]]],[[0,"let"],[1,"list:prev!"],[[0,"safety"],[1,"lambda"],[1,"list"],[1,"node"],[[0,"array:set!"],[1,"list"],[2,0],[[0,"array:set!"],[1,"node"],[2,2],[1,"list"]]]]],[[0,"let"],[1,"list:next!"],[[0,"safety"],[1,"lambda"],[1,"list"],[1,"node"],[[0,"array:set!"],[1,"list"],[2,2],[[0,"array:set!"],[1,"node"],[2,0],[1,"list"]]]]],[[0,"let"],[1,"list:prev"],[[0,"safety"],[1,"lambda"],[1,"list"],[[0,"array:get"],[1,"list"],[2,0]]]],[[0,"let"],[1,"list:next"],[[0,"safety"],[1,"lambda"],[1,"list"],[[0,"array:get"],[1,"list"],[2,2]]]],[[0,"let"],[1,"list:value"],[[0,"lambda"],[1,"node"],[[0,"array:get"],[1,"node"],[2,1]]]],[[0,"let"],[1,"var:def"],[[0,"safety"],[1,"lambda"],[1,"val"],[[0,"array"],[1,"val"]]]],[[0,"let"],[1,"var:get"],[[0,"safety"],[1,"lambda"],[1,"variable"],[[0,"car"],[1,"variable"]]]],[[0,"let"],[1,"var:set!"],[[0,"safety"],[1,"lambda"],[1,"variable"],[1,"value"],[[0,"array:set!"],[1,"variable"],[2,0],[1,"value"]]]],[[0,"let"],[1,"var:del!"],[[0,"safety"],[1,"lambda"],[1,"variable"],[[0,"array:set!"],[1,"variable"],[2,-1]]]],[[0,"let"],[1,"new:brray"],[[0,"lambda"],[[0,"array"],[[0,"array"],[]],[]]]],[[0,"let"],[1,"brray:offset-left"],[[0,"lambda"],[1,"q"],[[0,"*"],[[0,"-"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[2,1]],[2,-1]]]],[[0,"let"],[1,"brray:offset-right"],[[0,"lambda"],[1,"q"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]]]],[[0,"let"],[1,"brray:length"],[[0,"lambda"],[1,"q"],[[0,"+"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]],[2,-1]]]],[[0,"let"],[1,"brray:empty?"],[[0,"lambda"],[1,"q"],[[0,"not"],[[0,"brray:length"],[1,"q"]]]]],[[0,"let"],[1,"brray:empty!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"array:set!"],[1,"q"],[2,0],[[0,"array"],[]]],[[0,"array:set!"],[1,"q"],[2,1],[]],[1,"q"]]]],[[0,"let"],[1,"brray:get"],[[0,"lambda"],[1,"q"],[1,"offset"],[[0,"do"],[[0,"let"],[1,"offset-index"],[[0,"+"],[1,"offset"],[[0,"brray:offset-left"],[1,"q"]]]],[[0,"let"],[1,"index"],[[0,"if"],[[0,"<"],[1,"offset-index"],[2,0]],[[0,"*"],[1,"offset-index"],[2,-1]],[1,"offset-index"]]],[[0,"if"],[[0,">="],[1,"offset-index"],[2,0]],[[0,"array:get"],[[0,"array:get"],[1,"q"],[2,1]],[1,"index"]],[[0,"array:get"],[[0,"array:get"],[1,"q"],[2,0]],[1,"index"]]]]]],[[0,"let"],[1,"brray:set!"],[[0,"lambda"],[1,"q"],[1,"index"],[1,"value"],[[0,"do"],[[0,"let"],[1,"offset"],[[0,"+"],[1,"offset"],[[0,"brray:offset-left"],[1,"q"]]]],[[0,"if"],[[0,">="],[1,"offset"],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,1]],[1,"offset"],[1,"value"]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,0]],[[0,"*"],[1,"offset"],[2,-1]],[1,"value"]]],[1,"q"]]]],[[0,"let"],[1,"brray:add-to-left!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[[0,"let"],[1,"c"],[[0,"array:get"],[1,"q"],[2,0]]],[[0,"length"],[1,"c"]],[1,"item"]]]],[[0,"let"],[1,"brray:add-to-right!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"array:set!"],[[0,"let"],[1,"c"],[[0,"array:get"],[1,"q"],[2,1]]],[[0,"length"],[1,"c"]],[1,"item"]]]],[[0,"let"],[1,"brray:remove-from-left!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"when"],[1,"len"],[[0,"cond"],[[0,"="],[1,"len"],[2,1]],[[0,"brray:empty!"],[1,"q"]],[[0,">"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,0]]],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,0]],[2,-1]]]]]]],[[0,"let"],[1,"brray:remove-from-right!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"when"],[1,"len"],[[0,"cond"],[[0,"="],[1,"len"],[2,1]],[[0,"brray:empty!"],[1,"q"]],[[0,">"],[[0,"length"],[[0,"array:get"],[1,"q"],[2,1]]],[2,0]],[[0,"array:set!"],[[0,"array:get"],[1,"q"],[2,1]],[2,-1]]]]]]],[[0,"let"],[1,"brray:iter"],[[0,"lambda"],[1,"q"],[1,"callback"],[[0,"do"],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[[0,"brray:length"],[1,"q"]]]]]],[[0,"let"],[1,"brray:map"],[[0,"lambda"],[1,"q"],[1,"callback"],[[0,"do"],[[0,"let"],[1,"result"],[[0,"new:brray"]]],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"q"]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[1,"len"],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"result"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"result"],[[0,"callback"],[[0,"brray:get"],[1,"q"],[1,"index"]]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[1,"len"],[2,1]]],[1,"result"]]]],[[0,"let"],[1,"brray:balance?"],[[0,"lambda"],[1,"q"],[[0,"="],[[0,"+"],[[0,"brray:offset-right"],[1,"q"]],[[0,"brray:offset-left"],[1,"q"]]],[2,0]]]],[[0,"let"],[1,"brray:balance!"],[[0,"lambda"],[1,"q"],[[0,"if"],[[0,"brray:balance?"],[1,"q"]],[1,"q"],[[0,"do"],[[0,"let"],[1,"initial"],[[0,"cast:brray->array"],[1,"q"]]],[[0,"brray:empty!"],[1,"q"]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[[0,"length"],[1,"initial"]],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[[0,"array:get"],[1,"initial"],[1,"index"]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[[0,"length"],[1,"initial"]],[2,1]]],[1,"q"]]]]],[[0,"let"],[1,"brray:append!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"q"],[1,"item"]],[1,"q"]]]],[[0,"let"],[1,"brray:prepend!"],[[0,"lambda"],[1,"q"],[1,"item"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"q"],[1,"item"]],[1,"q"]]]],[[0,"let"],[1,"brray:head!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-right"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:remove-from-right!"],[1,"q"]],[1,"q"]]]],[[0,"let"],[1,"brray:tail!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-left"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:remove-from-left!"],[1,"q"]],[1,"q"]]]],[[0,"let"],[1,"brray:first"],[[0,"lambda"],[1,"q"],[[0,"brray:get"],[1,"q"],[2,0]]]],[[0,"let"],[1,"brray:last"],[[0,"lambda"],[1,"q"],[[0,"brray:get"],[1,"q"],[[0,"-"],[[0,"brray:length"],[1,"q"]],[2,1]]]]],[[0,"let"],[1,"brray:pop-right!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"last"],[[0,"brray:last"],[1,"q"]]],[[0,"brray:head!"],[1,"q"]],[1,"last"]]]],[[0,"let"],[1,"brray:pop-left!"],[[0,"lambda"],[1,"q"],[[0,"do"],[[0,"let"],[1,"first"],[[0,"brray:first"],[1,"q"]]],[[0,"brray:tail!"],[1,"q"]],[1,"first"]]]],[[0,"let"],[1,"brray:rotate-left!"],[[0,"lambda"],[1,"q"],[1,"n"],[[0,"do"],[[0,"let"],[1,"N"],[[0,"mod"],[1,"n"],[[0,"brray:length"],[1,"q"]]]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-left"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:add-to-right!"],[1,"q"],[[0,"brray:first"],[1,"q"]]],[[0,"brray:remove-from-left!"],[1,"q"]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[1,"N"]],[1,"q"]]]],[[0,"let"],[1,"brray:rotate-right!"],[[0,"lambda"],[1,"q"],[1,"n"],[[0,"do"],[[0,"let"],[1,"N"],[[0,"mod"],[1,"n"],[[0,"brray:length"],[1,"q"]]]],[[0,"let*"],[1,"iter"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"when"],[[0,"="],[[0,"brray:offset-right"],[1,"q"]],[2,0]],[[0,"brray:balance!"],[1,"q"]]],[[0,"brray:add-to-left!"],[1,"q"],[[0,"brray:last"],[1,"q"]]],[[0,"brray:remove-from-right!"],[1,"q"]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"iter"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"iter"],[2,0],[1,"N"]],[1,"q"]]]],[[0,"let"],[1,"brray:slice"],[[0,"lambda"],[1,"entity"],[1,"s"],[1,"e"],[[0,"do"],[[0,"let"],[1,"len"],[[0,"brray:length"],[1,"entity"]]],[[0,"let"],[1,"start"],[[0,"if"],[[0,"<"],[1,"s"],[2,0]],[[0,"math:max"],[[0,"+"],[1,"len"],[1,"s"]],[2,0]],[[0,"math:min"],[1,"s"],[1,"len"]]]],[[0,"let"],[1,"end"],[[0,"if"],[[0,"<"],[1,"e"],[2,0]],[[0,"math:max"],[[0,"+"],[1,"len"],[1,"e"]],[2,0]],[[0,"math:min"],[1,"e"],[1,"len"]]]],[[0,"let"],[1,"slice"],[[0,"new:brray"]]],[[0,"let"],[1,"slice-len"],[[0,"math:max"],[[0,"-"],[1,"end"],[1,"start"]],[2,0]]],[[0,"let"],[1,"half"],[[0,"math:floor"],[[0,"*"],[1,"slice-len"],[2,0.5]]]],[[0,"let*"],[1,"left"],[[0,"lambda"],[1,"index"],[[0,"do"],[[0,"brray:add-to-left!"],[1,"slice"],[[0,"brray:get"],[1,"entity"],[[0,"+"],[1,"start"],[1,"index"]]]],[[0,"when"],[[0,">"],[1,"index"],[2,0]],[[0,"left"],[[0,"-"],[1,"index"],[2,1]]]]]]],[[0,"left"],[[0,"-"],[1,"half"],[2,1]]],[[0,"let*"],[1,"rigth"],[[0,"lambda"],[1,"index"],[1,"bounds"],[[0,"do"],[[0,"brray:add-to-right!"],[1,"slice"],[[0,"brray:get"],[1,"entity"],[[0,"+"],[1,"start"],[1,"index"]]]],[[0,"when"],[[0,"<"],[1,"index"],[1,"bounds"]],[[0,"rigth"],[[0,"+"],[1,"index"],[2,1]],[1,"bounds"]]]]]],[[0,"rigth"],[1,"half"],[[0,"-"],[1,"slice-len"],[2,1]]],[1,"slice"]]]],[[0,"let"],[1,"date:add-seconds"],[[0,"lambda"],[1,"date-time"],[1,"seconds"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"seconds"],[2,1000]]]]],[[0,"let"],[1,"date:add-minutes"],[[0,"lambda"],[1,"date-time"],[1,"minutes"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"minutes"],[2,1000],[2,60]]]]],[[0,"let"],[1,"date:add-hours"],[[0,"lambda"],[1,"date-time"],[1,"hours"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"hours"],[2,1000],[2,60],[2,60]]]]],[[0,"let"],[1,"date:add-days"],[[0,"lambda"],[1,"date-time"],[1,"days"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"days"],[2,1000],[2,60],[2,60],[2,24]]]]],[[0,"let"],[1,"date:add-months"],[[0,"lambda"],[1,"date-time"],[1,"months"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"months"],[2,1000],[2,60],[2,60],[2,24],[2,30]]]]],[[0,"let"],[1,"date:add-years"],[[0,"lambda"],[1,"date-time"],[1,"years"],[[0,"+"],[1,"date-time"],[[0,"*"],[1,"years"],[2,1000],[2,60],[2,60],[2,24],[2,365]]]]],[[0,"let"],[1,"date:sub-seconds"],[[0,"lambda"],[1,"date-time"],[1,"seconds"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"seconds"],[2,1000]]]]],[[0,"let"],[1,"date:sub-minutes"],[[0,"lambda"],[1,"date-time"],[1,"minutes"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"minutes"],[2,1000],[2,60]]]]],[[0,"let"],[1,"date:sub-hours"],[[0,"lambda"],[1,"date-time"],[1,"hours"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"hours"],[2,1000],[2,60],[2,60]]]]],[[0,"let"],[1,"date:sub-days"],[[0,"lambda"],[1,"date-time"],[1,"days"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"days"],[2,1000],[2,60],[2,60],[2,24]]]]],[[0,"let"],[1,"date:sub-months"],[[0,"lambda"],[1,"date-time"],[1,"months"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"months"],[2,1000],[2,60],[2,60],[2,24],[2,30]]]]],[[0,"let"],[1,"date:sub-years"],[[0,"lambda"],[1,"date-time"],[1,"years"],[[0,"-"],[1,"date-time"],[[0,"*"],[1,"years"],[2,1000],[2,60],[2,60],[2,24],[2,365]]]]]]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.0.35",
5
+ "version": "1.0.37",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/utils.js CHANGED
@@ -2,7 +2,6 @@ import std from '../lib/baked/std.js'
2
2
  import { comp } from './compiler.js'
3
3
  import { APPLY, KEYWORDS, TYPE, VALUE, WORD } from './enums.js'
4
4
  import { run } from './interpreter.js'
5
- import { run as runPlain } from './plain/interpreter.js'
6
5
  import { isLeaf, parse } from './parser.js'
7
6
  export const logError = (error) => console.log('\x1b[31m', error, '\x1b[0m')
8
7
  export const logSuccess = (output) => console.log(output, '\x1b[0m')
@@ -158,12 +157,6 @@ export const runFromInterpreted = (source, env = {}) => {
158
157
  )
159
158
  run(tree, env)
160
159
  }
161
- export const runFromInterpretedPlain = (source, env = {}) => {
162
- const tree = parse(
163
- handleUnbalancedQuotes(handleUnbalancedParens(removeNoCode(source)))
164
- )
165
- runPlain(tree, env)
166
- }
167
160
  export const dfs = (tree, callback) => {
168
161
  if (!isLeaf(tree)) for (const leaf of tree) dfs(leaf)
169
162
  else callback(tree)
@@ -172,35 +165,43 @@ export const deepClone = (ast) => JSON.parse(JSON.stringify(ast))
172
165
  export const fez = (source, options = {}) => {
173
166
  const env = options.env ?? {}
174
167
  try {
175
- let code
176
- if (options.errors)
177
- code = handleUnbalancedQuotes(
178
- handleUnbalancedParens(removeNoCode(source))
179
- )
180
- else code = removeNoCode(source)
181
- if (!options.mutation) code = removeMutation(code)
182
- if (!code.length && options.throw) throw new Error('Nothing to parse!')
183
- const parsed = parse(code)
184
- if (parsed.length === 0 && options.throw)
185
- throw new Error(
186
- 'Top level expressions need to be wrapped in a (do) block'
187
- )
188
- const standard = options.std
189
- ? options.shake
190
- ? treeShake(parsed, std)
191
- : std
192
- : []
193
- const ast = [...standard, ...parsed]
194
- if (options.compile) {
195
- const js = Object.values(comp(deepClone(ast))).join('')
196
- return options.eval ? eval(js) : js
168
+ if (typeof source === 'string') {
169
+ let code
170
+ if (!options.compile)
171
+ code = handleUnbalancedQuotes(
172
+ handleUnbalancedParens(removeNoCode(source))
173
+ )
174
+ else code = removeNoCode(source)
175
+ if (!options.mutation) code = removeMutation(code)
176
+ if (!code.length && options.throw) throw new Error('Nothing to parse!')
177
+ const parsed = parse(code)
178
+ if (parsed.length === 0 && options.throw)
179
+ throw new Error(
180
+ 'Top level expressions need to be wrapped in a (do) block'
181
+ )
182
+ const ast = [...(options.std ? treeShake(parsed, std) : []), ...parsed]
183
+ if (options.compile) {
184
+ const js = Object.values(comp(deepClone(ast))).join('')
185
+ return options.eval ? eval(js) : js
186
+ }
187
+ return run(ast, env)
188
+ } else if (Array.isArray(source)) {
189
+ const ast = !options.mutation
190
+ ? JSON.parse(JSON.stringify(source).replace(new RegExp(/!/g), 'ǃ'))
191
+ : source
192
+ if (options.compile) {
193
+ const js = Object.values(comp(deepClone(ast))).join('')
194
+ return options.eval ? eval(js) : js
195
+ }
196
+ return run(ast, env)
197
+ } else {
198
+ throw new Error('Source has to be either a lisp source code or an AST')
197
199
  }
198
- return options.errors ? run(ast, env) : runPlain(ast, env)
199
200
  } catch (error) {
200
201
  const err = error.message
201
202
  .replace("'[object Array]'", '(array)')
202
203
  .replace('object', '(array)')
203
- if (options.errors) logError(err)
204
+ logError(err)
204
205
  if (options.throw) throw err
205
206
  return err
206
207
  }
@@ -293,6 +294,8 @@ export const decompress = (raw) => {
293
294
  }
294
295
  // shake(parse(removeNoCode(source)), std)
295
296
  export const shake = (parsed, std) => [...treeShake(parsed, std), ...parsed]
297
+ export const tree = (source, std) =>
298
+ std ? shake(parse(removeNoCode(source)), std) : parse(removeNoCode(source))
296
299
  export const lispToJavaScriptVariableName = (name) =>
297
300
  toCamelCase(
298
301
  arrowFromTo(
@@ -1,28 +0,0 @@
1
- import { APPLY, ATOM, KEYWORDS, TYPE, VALUE, WORD } from '../enums.js'
2
- import { isLeaf } from '../parser.js'
3
- import { keywords } from './tokeniser.js'
4
-
5
- export const evaluate = (exp, env) => {
6
- const [first, ...rest] = isLeaf(exp) ? [exp] : exp
7
- if (first == undefined) return []
8
- switch (first[TYPE]) {
9
- case WORD:
10
- return env[first[VALUE]]
11
- case APPLY:
12
- const apply = env[first[VALUE]]
13
- return apply(rest, env)
14
- case ATOM:
15
- return first[VALUE]
16
- default:
17
- break
18
- }
19
- }
20
- export const isAtom = (arg, env) => {
21
- if (arg[TYPE] === ATOM) return 1
22
- else {
23
- const atom = evaluate(arg, env)
24
- return +(typeof atom === 'number' || typeof atom === 'string')
25
- }
26
- }
27
- export const run = (tree, env = {}) =>
28
- keywords[KEYWORDS.BLOCK](tree, { ...keywords, ...env })
@@ -1,371 +0,0 @@
1
- import std from '../../lib/baked/std.js'
2
- import { isEqualTypes, stringifyArgs } from '../utils.js'
3
- import { TYPE, VALUE, WORD, KEYWORDS } from '../enums.js'
4
- import { evaluate, isAtom } from './interpreter.js'
5
- import { stringify } from '../parser.js'
6
- import { isEqual } from '../utils.js'
7
-
8
- const keywords = {
9
- [KEYWORDS.CONCATENATION]: (args, env) => {
10
- const operands = args.map((x) => evaluate(x, env))
11
- return operands.reduce((a, b) => a + b, '')
12
- },
13
- [KEYWORDS.REMAINDER_OF_DIVISION]: (args, env) => {
14
- const [a, b] = args.map((x) => evaluate(x, env))
15
- return a % b
16
- },
17
- [KEYWORDS.DIVISION]: (args, env) => {
18
- if (!args.length) return 0
19
- if (args.length === 1) {
20
- const number = evaluate(args[0], env)
21
- return 1 / number
22
- }
23
- const operands = args.map((x) => evaluate(x, env))
24
- return operands.reduce((a, b) => a / b)
25
- },
26
- [KEYWORDS.ARRAY_OR_STRING_LENGTH]: (args, env) => {
27
- const array = evaluate(args[0], env)
28
- return array.length
29
- },
30
- [KEYWORDS.IS_ARRAY]: (args, env) => {
31
- const array = evaluate(args[0], env)
32
- return +Array.isArray(array)
33
- },
34
- [KEYWORDS.IS_NUMBER]: (args, env) => {
35
- return +(typeof evaluate(args[0], env) === 'number')
36
- },
37
- [KEYWORDS.IS_STRING]: (args, env) => {
38
- return +(typeof evaluate(args[0], env) === 'string')
39
- },
40
- [KEYWORDS.IS_FUNCTION]: (args, env) => {
41
- return +(typeof evaluate(args[0], env) === 'function')
42
- },
43
- [KEYWORDS.ADDITION]: (args, env) => {
44
- if (!args.length) return 0 // identity
45
- const operands = args.map((x) => evaluate(x, env))
46
- return operands.reduce((a, b) => a + b)
47
- },
48
- [KEYWORDS.MULTIPLICATION]: (args, env) => {
49
- if (!args.length) return 1 // identity
50
- const operands = args.map((x) => evaluate(x, env))
51
- return operands.reduce((a, b) => a * b)
52
- },
53
- [KEYWORDS.SUBTRACTION]: (args, env) => {
54
- const operands = args.map((x) => evaluate(x, env))
55
- return args.length === 1 ? -operands[0] : operands.reduce((a, b) => a - b)
56
- },
57
- [KEYWORDS.IF]: (args, env) => {
58
- return evaluate(args[0], env)
59
- ? evaluate(args[1], env)
60
- : evaluate(args[2], env)
61
- },
62
- [KEYWORDS.UNLESS]: (args, env) => {
63
- return evaluate(args[0], env)
64
- ? evaluate(args[2], env)
65
- : evaluate(args[1], env)
66
- },
67
- [KEYWORDS.WHEN]: (args, env) => {
68
- return evaluate(args[0], env) ? evaluate(args[1], env) : 0
69
- },
70
- [KEYWORDS.OTHERWISE]: (args, env) => {
71
- return evaluate(args[0], env) ? 0 : evaluate(args[1], env)
72
- },
73
- [KEYWORDS.CONDITION]: (args, env) => {
74
- for (let i = 0; i < args.length; i += 2)
75
- if (evaluate(args[i], env)) return evaluate(args[i + 1], env)
76
- return 0
77
- },
78
- [KEYWORDS.ARRAY_TYPE]: (args, env) => {
79
- if (!args.length) return []
80
- const isCapacity =
81
- args.length === 2 && args[1][TYPE] === WORD && args[1][VALUE] === 'length'
82
- if (isCapacity) {
83
- const N = evaluate(args[0], env)
84
- return new Array(N).fill(0)
85
- }
86
- return args.map((x) => evaluate(x, env))
87
- },
88
- [KEYWORDS.IS_ATOM]: (args, env) => {
89
- return isAtom(args[0], env)
90
- },
91
- [KEYWORDS.FIRST_ARRAY]: (args, env) => {
92
- const array = evaluate(args[0], env)
93
- const value = array.at(0)
94
- return value
95
- },
96
- [KEYWORDS.REST_ARRAY]: (args, env) => {
97
- const array = evaluate(args[0], env)
98
- return array.slice(1)
99
- },
100
- [KEYWORDS.GET_ARRAY]: (args, env) => {
101
- const array = evaluate(args[0], env)
102
- const index = evaluate(args[1], env)
103
- const value = array.at(index)
104
- return value
105
- },
106
- [KEYWORDS.BLOCK]: (args, env) => {
107
- return args.reduce((_, x) => evaluate(x, env), 0)
108
- },
109
- [KEYWORDS.ANONYMOUS_FUNCTION]: (args, env) => {
110
- const params = args.slice(0, -1)
111
- const body = args.at(-1)
112
- return (props = [], scope) => {
113
- const localEnv = Object.create(env)
114
- for (let i = 0; i < props.length; ++i) {
115
- Object.defineProperty(localEnv, params[i][VALUE], {
116
- value: evaluate(props[i], scope),
117
- writable: true
118
- })
119
- }
120
- return evaluate(body, localEnv)
121
- }
122
- },
123
- [KEYWORDS.NOT]: (args, env) => {
124
- return +!evaluate(args[0], env)
125
- },
126
- [KEYWORDS.EQUAL]: (args, env) => {
127
- const a = evaluate(args[0], env)
128
- const b = evaluate(args[1], env)
129
- return +(a === b)
130
- },
131
- [KEYWORDS.LESS_THAN]: (args, env) => {
132
- const a = evaluate(args[0], env)
133
- const b = evaluate(args[1], env)
134
- return +(a < b)
135
- },
136
- [KEYWORDS.GREATHER_THAN]: (args, env) => {
137
- const a = evaluate(args[0], env)
138
- const b = evaluate(args[1], env)
139
- return +(a > b)
140
- },
141
- [KEYWORDS.GREATHER_THAN_OR_EQUAL]: (args, env) => {
142
- const a = evaluate(args[0], env)
143
- const b = evaluate(args[1], env)
144
- return +(a >= b)
145
- },
146
- [KEYWORDS.LESS_THAN_OR_EQUAL]: (args, env) => {
147
- const a = evaluate(args[0], env)
148
- const b = evaluate(args[1], env)
149
- return +(a <= b)
150
- },
151
- [KEYWORDS.AND]: (args, env) => {
152
- let circuit
153
- for (let i = 0; i < args.length - 1; ++i) {
154
- circuit = evaluate(args[i], env)
155
- if (circuit) continue
156
- else return circuit
157
- }
158
- return evaluate(args.at(-1), env)
159
- },
160
- [KEYWORDS.OR]: (args, env) => {
161
- let circuit
162
- for (let i = 0; i < args.length - 1; ++i) {
163
- circuit = evaluate(args[i], env)
164
- if (circuit) return circuit
165
- else continue
166
- }
167
- return evaluate(args.at(-1), env)
168
- },
169
- [KEYWORDS.CALL_FUNCTION]: (args, env) => {
170
- const [first, ...rest] = args
171
- const apply = evaluate(first, env)
172
- return apply(rest, env)
173
- },
174
- [KEYWORDS.DEFINE_VARIABLE]: (args, env) => {
175
- let name
176
- const word = args[0]
177
- name = word[VALUE]
178
- Object.defineProperty(env, name, {
179
- value: evaluate(args[1], env),
180
- writable: false
181
- })
182
- return env[name]
183
- },
184
- [KEYWORDS.STRING_TYPE]: () => '',
185
- [KEYWORDS.NUMBER_TYPE]: () => 0,
186
- [KEYWORDS.BOOLEAN_TYPE]: () => 1,
187
- [KEYWORDS.CAST_TYPE]: (args, env) => {
188
- const type = args[1][VALUE]
189
- const value = evaluate(args[0], env)
190
- if (args.length === 2) {
191
- switch (type) {
192
- case KEYWORDS.NUMBER_TYPE: {
193
- const num = Number(value)
194
- return num
195
- }
196
- case KEYWORDS.STRING_TYPE:
197
- return value.toString()
198
- case KEYWORDS.BOOLEAN_TYPE:
199
- return +!!value
200
- case KEYWORDS.ARRAY_TYPE: {
201
- if (typeof value === 'number')
202
- return [...Number(value).toString()].map(Number)
203
- return [...value]
204
- }
205
- case KEYWORDS.CHAR_TYPE: {
206
- const index = evaluate(args[0], env)
207
- return String.fromCharCode(index)
208
- }
209
- case KEYWORDS.CHAR_CODE_TYPE: {
210
- const string = evaluate(args[0], env)
211
- return string.charCodeAt(0)
212
- }
213
- default:
214
- break
215
- }
216
- }
217
- },
218
- [KEYWORDS.BITWISE_AND]: (args, env) => {
219
- const operands = args.map((a) => evaluate(a, env))
220
- return operands.reduce((acc, x) => acc & x)
221
- },
222
- [KEYWORDS.BITWISE_NOT]: (args, env) => {
223
- const operand = evaluate(args[0], env)
224
- return ~operand
225
- },
226
- [KEYWORDS.BITWISE_OR]: (args, env) => {
227
- const operands = args.map((a) => evaluate(a, env))
228
- return operands.reduce((acc, x) => acc | x)
229
- },
230
- [KEYWORDS.BITWISE_XOR]: (args, env) => {
231
- const operands = args.map((a) => evaluate(a, env))
232
- return operands.reduce((acc, x) => acc ^ x)
233
- },
234
- [KEYWORDS.BITWISE_LEFT_SHIFT]: (args, env) => {
235
- const operands = args.map((a) => evaluate(a, env))
236
- return operands.reduce((acc, x) => acc << x)
237
- },
238
- [KEYWORDS.BITWISE_RIGHT_SHIFT]: (args, env) => {
239
- const operands = args.map((a) => evaluate(a, env))
240
- return operands.reduce((acc, x) => acc >> x)
241
- },
242
- [KEYWORDS.BITWISE_UNSIGNED_RIGHT_SHIFT]: (args, env) => {
243
- const operands = args.map((a) => evaluate(a, env))
244
- return operands.reduce((acc, x) => acc >>> x)
245
- },
246
- [KEYWORDS.PIPE]: (args, env) => {
247
- let inp = args[0]
248
- for (let i = 1; i < args.length; ++i) {
249
- const [first, ...rest] = args[i]
250
- const arr = [first, inp, ...rest]
251
- inp = arr
252
- }
253
- return evaluate(inp, env)
254
- },
255
- [KEYWORDS.THROW_ERROR]: (args, env) => {
256
- const string = evaluate(args[0], env)
257
- throw new Error(string)
258
- },
259
- [KEYWORDS.MERGE]: (args, env) => {
260
- const arrays = args.map((arg) => evaluate(arg, env))
261
- return arrays.reduce((a, b) => a.concat(b), [])
262
- },
263
- [KEYWORDS.IMMUTABLE_FUNCTION]: (args, env) => {
264
- const [, ...functionArgs] = args
265
- const params = functionArgs.slice(0, -1)
266
- const body = functionArgs.at(-1)
267
- return (props = [], scope) => {
268
- const localEnv = Object.create({ ...keywords })
269
- for (let i = 0; i < props.length; ++i) {
270
- Object.defineProperty(localEnv, params[i][VALUE], {
271
- value: evaluate(props[i], scope),
272
- writable: true
273
- })
274
- }
275
- return evaluate(body, localEnv)
276
- }
277
- },
278
- [KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION]: (args, env) => {
279
- return keywords[KEYWORDS.DEFINE_VARIABLE](args, env)
280
- },
281
- [KEYWORDS.TEST_CASE]: (args, env) => {
282
- const description = evaluate(args[0], env)
283
- const a = evaluate(args[1], env)
284
- const b = evaluate(args[2], env)
285
- return !isEqualTypes(a, b) || !isEqual(a, b)
286
- ? [0, description, stringifyArgs([args[1]]), b, a]
287
- : [1, description, stringifyArgs([args[1]]), a]
288
- },
289
- [KEYWORDS.TEST_BED]: (args, env) => {
290
- let tests = []
291
- try {
292
- tests = args.map((x) => evaluate(x, env))
293
- tests.forEach(([state, describe, ...rest]) =>
294
- !state
295
- ? console.log(
296
- '\x1b[31m',
297
- `${describe} Failed:\n`,
298
- `${rest[0]} => ${stringify(rest[1])} != ${stringify(rest[2])}`,
299
- '\n',
300
- '\x1b[0m'
301
- )
302
- : console.log(
303
- '\x1b[32m',
304
- `${describe} Passed:\n`,
305
- `${rest[0]} => ${stringify(rest[1])}`,
306
- '\n',
307
- '\x1b[0m'
308
- )
309
- )
310
- } catch (err) {
311
- console.log('\x1b[31m', 'Tests failed: \n', err.toString())
312
- }
313
- const result = !tests.length || tests.some(([t]) => !t)
314
- result
315
- ? console.log('\x1b[31m', 'Some tests failed!', '\n', '\x1b[0m')
316
- : console.log('\x1b[32m', 'All tests passed!', '\n', '\x1b[0m')
317
- return +!result
318
- },
319
- [KEYWORDS.SERIALISE]: (args, env) => {
320
- const data = evaluate(args[0], env)
321
- return stringify(data)
322
- },
323
- [KEYWORDS.SET_ARRAY]: (args, env) => {
324
- const array = evaluate(args[0], env)
325
- const index = evaluate(args[1], env)
326
- if (index < 0) {
327
- const target = array.length + index
328
- while (array.length !== target) array.pop()
329
- } else {
330
- const value = evaluate(args[2], env)
331
- array[index] = value
332
- }
333
- return array
334
- },
335
- [KEYWORDS.LOG]: (args, env) => {
336
- const expressions = args.map((x) => evaluate(x, env))
337
- console.log(...expressions)
338
- return expressions.at(-1)
339
- },
340
- [KEYWORDS.CLEAR_CONSOLE]: (args) => {
341
- console.clear()
342
- return 0
343
- }
344
- }
345
- keywords[KEYWORDS.NOT_COMPILED_BLOCK] = keywords[KEYWORDS.BLOCK]
346
- keywords[KEYWORDS.DOC] = (args, env) => {
347
- const lib = evaluate(args[0], env)
348
- const kw = Object.keys(env).map((x) => [x])
349
- const standard = std.map(([_, [_0, name], [_1, ...arg]]) => {
350
- const args = arg
351
- .slice(0, -1)
352
- .map((x) => x[VALUE])
353
- .filter((x) => x !== 'lambda')
354
- return [name, ...args]
355
- })
356
- const all = [...kw, ...standard]
357
- switch (lib) {
358
- case '*':
359
- return all.map((x) => `(${x.join(' ')})`)
360
- case 'keywords':
361
- return kw.map((x) => `(${x.join(' ')})`)
362
- case 'std':
363
- return standard.map((x) => `(${x.join(' ')})`)
364
- default:
365
- return all
366
- .filter((name) => name[0].includes(lib))
367
- .map((x) => `(${x.join(' ')})`)
368
- }
369
- }
370
-
371
- export { keywords }