fez-lisp 1.0.32 → 1.0.34
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/baked/std.js +1 -1
- package/package.json +3 -2
- package/src/compiler.js +96 -108
- package/src/enums.js +1 -1
- package/src/formatter.js +1 -9
- package/src/plain/tokeniser.js +4 -5
- package/src/tokeniser.js +15 -6
- package/src/utils.js +5 -13
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,"pi"],[1,"xs"],[[0,"array:enumerated-map"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"pi"],[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: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,"pi"],[[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,"pi"],[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: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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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: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: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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[1,"str"],[[0,"string:trim-left"]],[[0,"string:trim-right"]]]]],[[0,"let"],[1,"string:lines"],[[0,"lambda"],[1,"str"],[[0,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[[0,"pi"],[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,"cast:table->array"],[[0,"lambda"],[1,"set"],[[0,"array:select"],[[0,"array:flat"],[1,"set"]],[1,"atom?"]]]],[[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,"cast:map->string"],[[0,"lambda"],[1,"table"],[[0,"pi"],[1,"table"],[[0,"array:select"],[1,"length"]],[[0,"array:map"],[[0,"lambda"],[1,"x"],[[0,"array:join"],[[0,"array:map"],[1,"x"],[[0,"lambda"],[1,"y"],[[0,"array:join"],[1,"y"],[2," -> "]]]],[2," "]]]],[[0,"array:join"],[2,"\n"]]]]],[[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,"pi"],[1,"xs"],[[0,"array:enumerated-map"],[[0,"lambda"],[1,"x"],[1,"i"],[[0,"pi"],[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,"pi"],[[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[1,"str"],[[0,"string:trim-left"]],[[0,"string:trim-right"]]]]],[[0,"let"],[1,"string:lines"],[[0,"lambda"],[1,"str"],[[0,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[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,"pi"],[1,"a"],[[0,"cast:table->array"]],[[0,"array:for"],[[0,"lambda"],[1,"element"],[[0,"set:add!"],[1,"out"],[1,"element"]]]]],[[0,"pi"],[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.
|
5
|
+
"version": "1.0.34",
|
6
6
|
"type": "module",
|
7
7
|
"main": "index.js",
|
8
8
|
"keywords": [
|
@@ -18,7 +18,8 @@
|
|
18
18
|
},
|
19
19
|
"prettier": {
|
20
20
|
"semi": false,
|
21
|
-
"singleQuote": true
|
21
|
+
"singleQuote": true,
|
22
|
+
"trailingComma": "none"
|
22
23
|
},
|
23
24
|
"scripts": {
|
24
25
|
"build": "node ./lib/builder.js",
|
package/src/compiler.js
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
KEYWORDS,
|
6
6
|
TYPE,
|
7
7
|
VALUE,
|
8
|
-
WORD
|
8
|
+
WORD
|
9
9
|
} from './enums.js'
|
10
10
|
import { leaf, isLeaf } from './parser.js'
|
11
11
|
import { deepRename, lispToJavaScriptVariableName } from './utils.js'
|
@@ -49,11 +49,11 @@ let result=fn(...args)
|
|
49
49
|
while(typeof result==='function')result=result()
|
50
50
|
return result
|
51
51
|
}`,
|
52
|
-
numberPredicate: `numberPredicate=(number)
|
53
|
-
stringPredicate: `stringPredicate=(string)
|
54
|
-
lambdaPredicate: `lambdaPredicate=(lambda)
|
55
|
-
arrayPredicate: `arrayPredicate=(array)
|
56
|
-
atomPredicate: `atomPredicate=(value)
|
52
|
+
numberPredicate: `numberPredicate=(number)=>+(typeof number==='number')`,
|
53
|
+
stringPredicate: `stringPredicate=(string)=>+(typeof string==='string')`,
|
54
|
+
lambdaPredicate: `lambdaPredicate=(lambda)=>+(typeof lambda==='function')`,
|
55
|
+
arrayPredicate: `arrayPredicate=(array)=>+Array.isArray(array)`,
|
56
|
+
atomPredicate: `atomPredicate=(value)=>+(typeof value==='number'||typeof value==='string')`,
|
57
57
|
error: `error=(error)=>{
|
58
58
|
throw new Error(error)
|
59
59
|
}`,
|
@@ -85,9 +85,8 @@ return result
|
|
85
85
|
default:
|
86
86
|
return 0
|
87
87
|
}
|
88
|
-
}
|
88
|
+
}`
|
89
89
|
}
|
90
|
-
const handleBoolean = (source) => `+${source}`
|
91
90
|
const semiColumnEdgeCases = new Set([
|
92
91
|
';)',
|
93
92
|
';-',
|
@@ -106,13 +105,13 @@ const semiColumnEdgeCases = new Set([
|
|
106
105
|
';?',
|
107
106
|
',,',
|
108
107
|
';;',
|
109
|
-
';]'
|
108
|
+
';]'
|
110
109
|
])
|
111
110
|
|
112
|
-
const parse = (Arguments,
|
113
|
-
const parseArgs = (Arguments,
|
114
|
-
parse(Arguments,
|
115
|
-
const compile = (tree,
|
111
|
+
const parse = (Arguments, Drill) => Arguments.map((x) => compile(x, Drill))
|
112
|
+
const parseArgs = (Arguments, Drill, separator = ',') =>
|
113
|
+
parse(Arguments, Drill).join(separator)
|
114
|
+
const compile = (tree, Drill) => {
|
116
115
|
if (!tree) return ''
|
117
116
|
const [first, ...Arguments] = !isLeaf(tree) ? tree : [tree]
|
118
117
|
if (first == undefined) return '[];'
|
@@ -122,55 +121,47 @@ const compile = (tree, Drills) => {
|
|
122
121
|
case KEYWORDS.BLOCK: {
|
123
122
|
if (Arguments.length > 1) {
|
124
123
|
return `(${Arguments.map((x) =>
|
125
|
-
(compile(x,
|
124
|
+
(compile(x, Drill) ?? '').toString().trimStart()
|
126
125
|
)
|
127
126
|
.filter(Boolean)
|
128
127
|
.join(',')});`
|
129
128
|
} else {
|
130
|
-
const res = compile(Arguments[0],
|
129
|
+
const res = compile(Arguments[0], Drill)
|
131
130
|
return res !== undefined ? res.toString().trim() : ''
|
132
131
|
}
|
133
132
|
}
|
134
133
|
case KEYWORDS.CALL_FUNCTION: {
|
135
134
|
const [first, ...rest] = Arguments
|
136
|
-
const apply = compile(first,
|
135
|
+
const apply = compile(first, Drill)
|
137
136
|
return `${
|
138
137
|
apply[apply.length - 1] === ';'
|
139
138
|
? apply.substring(0, apply.length - 1)
|
140
139
|
: apply
|
141
|
-
}(${parseArgs(rest,
|
140
|
+
}(${parseArgs(rest, Drill)})`
|
142
141
|
}
|
143
142
|
case KEYWORDS.DEFINE_VARIABLE: {
|
144
143
|
let name,
|
145
144
|
out = '(('
|
146
145
|
if (Arguments[0][TYPE] === WORD) {
|
147
146
|
name = lispToJavaScriptVariableName(Arguments[0][VALUE])
|
148
|
-
|
147
|
+
Drill.Variables.add(name)
|
149
148
|
}
|
150
|
-
out += `${name}=${compile(Arguments[1],
|
149
|
+
out += `${name}=${compile(Arguments[1], Drill)}`
|
151
150
|
out += `),${name});`
|
152
151
|
return out
|
153
152
|
}
|
154
153
|
case KEYWORDS.IS_STRING:
|
155
|
-
|
156
|
-
return
|
157
|
-
`stringPredicate(${compile(Arguments[0], Drills)});`
|
158
|
-
)
|
154
|
+
Drill.Helpers.add('stringPredicate')
|
155
|
+
return `stringPredicate(${compile(Arguments[0], Drill)});`
|
159
156
|
case KEYWORDS.IS_NUMBER:
|
160
|
-
|
161
|
-
return
|
162
|
-
`numberPredicate(${compile(Arguments[0], Drills)});`
|
163
|
-
)
|
157
|
+
Drill.Helpers.add('numberPredicate')
|
158
|
+
return `numberPredicate(${compile(Arguments[0], Drill)});`
|
164
159
|
case KEYWORDS.IS_FUNCTION:
|
165
|
-
|
166
|
-
return
|
167
|
-
`lambdaPredicate(${compile(Arguments[0], Drills)});`
|
168
|
-
)
|
160
|
+
Drill.Helpers.add('lambdaPredicate')
|
161
|
+
return `lambdaPredicate(${compile(Arguments[0], Drill)});`
|
169
162
|
case KEYWORDS.IS_ARRAY:
|
170
|
-
|
171
|
-
return
|
172
|
-
`arrayPredicate(${compile(Arguments[0], Drills)});`
|
173
|
-
)
|
163
|
+
Drill.Helpers.add('arrayPredicate')
|
164
|
+
return `arrayPredicate(${compile(Arguments[0], Drill)});`
|
174
165
|
case KEYWORDS.NUMBER_TYPE:
|
175
166
|
return '0'
|
176
167
|
case KEYWORDS.BOOLEAN_TYPE:
|
@@ -181,33 +172,33 @@ const compile = (tree, Drills) => {
|
|
181
172
|
return Arguments.length === 2 &&
|
182
173
|
Arguments[1][TYPE] === WORD &&
|
183
174
|
Arguments[1][VALUE] === 'length'
|
184
|
-
? `(new Array(${compile(Arguments[0],
|
185
|
-
: `[${parseArgs(Arguments,
|
175
|
+
? `(new Array(${compile(Arguments[0], Drill)}).fill(0))`
|
176
|
+
: `[${parseArgs(Arguments, Drill)}];`
|
186
177
|
case KEYWORDS.ARRAY_OR_STRING_LENGTH:
|
187
|
-
|
188
|
-
return `length(${compile(Arguments[0],
|
178
|
+
Drill.Helpers.add('length')
|
179
|
+
return `length(${compile(Arguments[0], Drill)})`
|
189
180
|
case KEYWORDS.IS_ATOM:
|
190
|
-
|
191
|
-
return
|
181
|
+
Drill.Helpers.add('atomPredicate')
|
182
|
+
return `atomPredicate(${compile(Arguments[0], Drill)});`
|
192
183
|
case KEYWORDS.FIRST_ARRAY:
|
193
|
-
|
194
|
-
return `car(${compile(Arguments[0],
|
184
|
+
Drill.Helpers.add('car')
|
185
|
+
return `car(${compile(Arguments[0], Drill)});`
|
195
186
|
case KEYWORDS.REST_ARRAY:
|
196
|
-
|
197
|
-
return `cdr(${compile(Arguments[0],
|
187
|
+
Drill.Helpers.add('cdr')
|
188
|
+
return `cdr(${compile(Arguments[0], Drill)});`
|
198
189
|
case KEYWORDS.GET_ARRAY:
|
199
|
-
|
200
|
-
return `array_get(${compile(Arguments[0],
|
190
|
+
Drill.Helpers.add('array_get')
|
191
|
+
return `array_get(${compile(Arguments[0], Drill)}, ${compile(
|
201
192
|
Arguments[1],
|
202
|
-
|
193
|
+
Drill
|
203
194
|
)});`
|
204
195
|
case KEYWORDS.MERGE:
|
205
|
-
|
206
|
-
return `array_merge(${parseArgs(Arguments,
|
196
|
+
Drill.Helpers.add('array_merge')
|
197
|
+
return `array_merge(${parseArgs(Arguments, Drill)});`
|
207
198
|
case KEYWORDS.ANONYMOUS_FUNCTION: {
|
208
199
|
const functionArgs = Arguments
|
209
200
|
const body = Arguments.pop()
|
210
|
-
const InnerDrills = { Variables: new Set(), Helpers:
|
201
|
+
const InnerDrills = { Variables: new Set(), Helpers: Drill.Helpers }
|
211
202
|
const evaluatedBody = compile(body, InnerDrills)
|
212
203
|
const vars = InnerDrills.Variables.size
|
213
204
|
? `var ${[...InnerDrills.Variables].join(',')};`
|
@@ -228,57 +219,57 @@ const compile = (tree, Drills) => {
|
|
228
219
|
const arg = Arguments[0]
|
229
220
|
name = lispToJavaScriptVariableName(arg[VALUE])
|
230
221
|
newName = `rec_${performance.now().toString().replace('.', 7)}`
|
231
|
-
|
232
|
-
|
233
|
-
|
222
|
+
Drill.Variables.add(name)
|
223
|
+
Drill.Variables.add(newName)
|
224
|
+
Drill.Helpers.add('__tco')
|
234
225
|
const functionArgs = Arguments[1].slice(1)
|
235
226
|
const body = functionArgs.pop()
|
236
|
-
const
|
227
|
+
const FunctionDrill = { Variables: new Set(), Helpers: Drill.Helpers }
|
237
228
|
deepRename(arg[VALUE], newName, body)
|
238
|
-
const evaluatedBody = compile(body,
|
239
|
-
const vars =
|
240
|
-
? `var ${[...
|
229
|
+
const evaluatedBody = compile(body, FunctionDrill)
|
230
|
+
const vars = FunctionDrill.Variables.size
|
231
|
+
? `var ${[...FunctionDrill.Variables].join(',')};`
|
241
232
|
: ''
|
242
233
|
out += `${name}=(__tco(${newName}=(${parseArgs(
|
243
234
|
functionArgs,
|
244
|
-
|
235
|
+
Drill
|
245
236
|
)})=>{${vars}return ${evaluatedBody.toString().trimStart()}};`
|
246
237
|
out += `, ${newName}))), ${name});`
|
247
238
|
return out
|
248
239
|
}
|
249
240
|
case KEYWORDS.AND:
|
250
|
-
return `(${parseArgs(Arguments,
|
241
|
+
return `(${parseArgs(Arguments, Drill, '&&')});`
|
251
242
|
case KEYWORDS.OR:
|
252
|
-
return `((${parseArgs(Arguments,
|
243
|
+
return `((${parseArgs(Arguments, Drill, '||')}) || 0);`
|
253
244
|
case KEYWORDS.CONCATENATION:
|
254
|
-
return '(' + parseArgs(Arguments,
|
245
|
+
return '(' + parseArgs(Arguments, Drill, '+') + ');'
|
255
246
|
case KEYWORDS.EQUAL:
|
256
|
-
return
|
247
|
+
return `+(${parseArgs(Arguments, Drill, '===')});`
|
257
248
|
case KEYWORDS.GREATHER_THAN_OR_EQUAL:
|
258
249
|
case KEYWORDS.LESS_THAN_OR_EQUAL:
|
259
250
|
case KEYWORDS.GREATHER_THAN:
|
260
251
|
case KEYWORDS.LESS_THAN:
|
261
|
-
return
|
252
|
+
return `+(${parseArgs(Arguments, Drill, token)});`
|
262
253
|
case KEYWORDS.SUBTRACTION:
|
263
254
|
return Arguments.length === 1
|
264
|
-
? `(-${compile(Arguments[0],
|
265
|
-
: `(${parse(Arguments,
|
255
|
+
? `(-${compile(Arguments[0], Drill)});`
|
256
|
+
: `(${parse(Arguments, Drill)
|
266
257
|
// Add space so it doesn't consider it 2--1 but 2- -1
|
267
258
|
.map((x) => (typeof x === 'number' && x < 0 ? ` ${x}` : x))
|
268
259
|
.join(token)});`
|
269
260
|
case KEYWORDS.MULTIPLICATION:
|
270
261
|
return Arguments.length
|
271
|
-
? `(${parseArgs(Arguments,
|
262
|
+
? `(${parseArgs(Arguments, Drill, token)});`
|
272
263
|
: `(1);`
|
273
264
|
case KEYWORDS.DIVISION:
|
274
265
|
return Arguments.length
|
275
266
|
? Arguments.length === 1
|
276
|
-
? `(1/${compile(Arguments[0],
|
277
|
-
: `(${parseArgs(Arguments,
|
267
|
+
? `(1/${compile(Arguments[0], Drill)});`
|
268
|
+
: `(${parseArgs(Arguments, Drill, token)});`
|
278
269
|
: `(0);`
|
279
270
|
case KEYWORDS.ADDITION:
|
280
271
|
return Arguments.length
|
281
|
-
? `(${parseArgs(Arguments,
|
272
|
+
? `(${parseArgs(Arguments, Drill, token)});`
|
282
273
|
: `(0);`
|
283
274
|
case KEYWORDS.BITWISE_AND:
|
284
275
|
case KEYWORDS.BITWISE_OR:
|
@@ -286,74 +277,71 @@ const compile = (tree, Drills) => {
|
|
286
277
|
case KEYWORDS.BITWISE_LEFT_SHIFT:
|
287
278
|
case KEYWORDS.BITWISE_RIGHT_SHIFT:
|
288
279
|
case KEYWORDS.BITWISE_UNSIGNED_RIGHT_SHIFT:
|
289
|
-
return `(${parseArgs(Arguments,
|
280
|
+
return `(${parseArgs(Arguments, Drill, token)});`
|
290
281
|
case KEYWORDS.REMAINDER_OF_DIVISION:
|
291
|
-
return `(${compile(Arguments[0],
|
282
|
+
return `(${compile(Arguments[0], Drill)}%${compile(
|
292
283
|
Arguments[1],
|
293
|
-
|
284
|
+
Drill
|
294
285
|
)});`
|
295
286
|
case KEYWORDS.BIT_TYPE:
|
296
|
-
return `(${compile(Arguments[0],
|
287
|
+
return `(${compile(Arguments[0], Drill)}>>>0).toString(2)`
|
297
288
|
case KEYWORDS.BITWISE_NOT:
|
298
|
-
return `~(${compile(Arguments[0],
|
289
|
+
return `~(${compile(Arguments[0], Drill)})`
|
299
290
|
case KEYWORDS.NOT:
|
300
|
-
return `(
|
291
|
+
return `(+!${compile(Arguments[0], Drill)})`
|
301
292
|
case KEYWORDS.IF: {
|
302
|
-
return `(${compile(Arguments[0],
|
293
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
303
294
|
Arguments[1],
|
304
|
-
|
305
|
-
)}:${compile(Arguments[2],
|
295
|
+
Drill
|
296
|
+
)}:${compile(Arguments[2], Drill)});`
|
306
297
|
}
|
307
298
|
case KEYWORDS.WHEN: {
|
308
|
-
return `(${compile(Arguments[0],
|
299
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
309
300
|
Arguments[1],
|
310
|
-
|
301
|
+
Drill
|
311
302
|
)}:0);`
|
312
303
|
}
|
313
304
|
case KEYWORDS.UNLESS: {
|
314
|
-
return `(${compile(Arguments[0],
|
305
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
315
306
|
Arguments[2],
|
316
|
-
|
317
|
-
)}:${compile(Arguments[1],
|
307
|
+
Drill
|
308
|
+
)}:${compile(Arguments[1], Drill)});`
|
318
309
|
}
|
319
310
|
case KEYWORDS.OTHERWISE: {
|
320
|
-
return `(${compile(Arguments[0],
|
311
|
+
return `(${compile(Arguments[0], Drill)}?0:${compile(
|
321
312
|
Arguments[1],
|
322
|
-
|
313
|
+
Drill
|
323
314
|
)});`
|
324
315
|
}
|
325
316
|
case KEYWORDS.CONDITION: {
|
326
317
|
let out = '('
|
327
318
|
for (let i = 0; i < Arguments.length; i += 2)
|
328
|
-
out += `${compile(Arguments[i],
|
319
|
+
out += `${compile(Arguments[i], Drill)}?${compile(
|
329
320
|
Arguments[i + 1],
|
330
|
-
|
321
|
+
Drill
|
331
322
|
)}:`
|
332
323
|
out += '0);'
|
333
324
|
return out
|
334
325
|
}
|
335
326
|
case KEYWORDS.CAST_TYPE:
|
336
|
-
|
337
|
-
return `cast("${Arguments[1][VALUE]}", ${compile(
|
338
|
-
Arguments[0],
|
339
|
-
Drills
|
340
|
-
)})`
|
327
|
+
Drill.Helpers.add('cast')
|
328
|
+
return `cast("${Arguments[1][VALUE]}", ${compile(Arguments[0], Drill)})`
|
341
329
|
case KEYWORDS.PIPE: {
|
342
330
|
let inp = Arguments[0]
|
343
331
|
for (let i = 1; i < Arguments.length; ++i)
|
344
332
|
inp = [Arguments[i].shift(), inp, ...Arguments[i]]
|
345
|
-
return compile(inp,
|
333
|
+
return compile(inp, Drill)
|
346
334
|
}
|
347
335
|
case KEYWORDS.IMMUTABLE_FUNCTION: {
|
348
336
|
const [first, ...rest] = Arguments
|
349
|
-
return compile([leaf(APPLY, first[VALUE]), ...rest],
|
337
|
+
return compile([leaf(APPLY, first[VALUE]), ...rest], Drill)
|
350
338
|
}
|
351
339
|
// case KEYWORDS.SERIALISE:
|
352
|
-
//
|
353
|
-
// return `serialise(${compile(Arguments[0],
|
340
|
+
// Drill.Helpers.add('serialise')
|
341
|
+
// return `serialise(${compile(Arguments[0], Drill)});`
|
354
342
|
// case KEYWORDS.SET_ARRAY:
|
355
|
-
//
|
356
|
-
// return `arraySetEffect(${parseArgs(Arguments,
|
343
|
+
// Drill.Helpers.add('arraySetEffect')
|
344
|
+
// return `arraySetEffect(${parseArgs(Arguments, Drill)});`
|
357
345
|
case KEYWORDS.NOT_COMPILED_BLOCK:
|
358
346
|
case KEYWORDS.ATOM:
|
359
347
|
case KEYWORDS.TEST_CASE:
|
@@ -362,8 +350,8 @@ const compile = (tree, Drills) => {
|
|
362
350
|
return ''
|
363
351
|
default: {
|
364
352
|
const camelCased = lispToJavaScriptVariableName(token)
|
365
|
-
if (camelCased in Helpers)
|
366
|
-
return `${camelCased}(${parseArgs(Arguments,
|
353
|
+
if (camelCased in Helpers) Drill.Helpers.add(camelCased)
|
354
|
+
return `${camelCased}(${parseArgs(Arguments, Drill)});`
|
367
355
|
}
|
368
356
|
}
|
369
357
|
} else if (first[TYPE] === ATOM)
|
@@ -372,15 +360,15 @@ const compile = (tree, Drills) => {
|
|
372
360
|
: first[VALUE]
|
373
361
|
else if (first[TYPE] === WORD) {
|
374
362
|
const camelCased = lispToJavaScriptVariableName(token)
|
375
|
-
if (camelCased in Helpers)
|
363
|
+
if (camelCased in Helpers) Drill.Helpers.add(camelCased)
|
376
364
|
return camelCased
|
377
365
|
}
|
378
366
|
}
|
379
367
|
const HelpersEntries = new Map(Object.entries(Helpers))
|
380
368
|
export const comp = (ast) => {
|
381
|
-
const
|
369
|
+
const Drill = { Variables: new Set(), Helpers: new Set() }
|
382
370
|
const raw = ast
|
383
|
-
.map((tree) => compile(tree,
|
371
|
+
.map((tree) => compile(tree, Drill))
|
384
372
|
.filter(Boolean)
|
385
373
|
.join('\n')
|
386
374
|
let program = ''
|
@@ -389,13 +377,13 @@ export const comp = (ast) => {
|
|
389
377
|
const next = raw[i + 1]
|
390
378
|
if (!semiColumnEdgeCases.has(current + next)) program += current
|
391
379
|
}
|
392
|
-
const help =
|
393
|
-
? `var ${[...
|
380
|
+
const help = Drill.Helpers.size
|
381
|
+
? `var ${[...Drill.Helpers.keys()]
|
394
382
|
.map((x) => HelpersEntries.get(x))
|
395
383
|
.join(',')};\n`
|
396
384
|
: ''
|
397
|
-
const vars =
|
398
|
-
? `var ${[...
|
385
|
+
const vars = Drill.Variables.size
|
386
|
+
? `var ${[...Drill.Variables].join(',')};`
|
399
387
|
: ''
|
400
388
|
const top = `${help}${vars}`
|
401
389
|
return { top, program }
|
package/src/enums.js
CHANGED
package/src/formatter.js
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
APPLY,
|
3
|
-
ATOM,
|
4
|
-
PLACEHOLDER,
|
5
|
-
KEYWORDS,
|
6
|
-
TYPE,
|
7
|
-
VALUE,
|
8
|
-
WORD,
|
9
|
-
} from './enums.js'
|
1
|
+
import { APPLY, ATOM, KEYWORDS, TYPE, VALUE, WORD } from './enums.js'
|
10
2
|
import { isLeaf, parse } from './parser.js'
|
11
3
|
import { removeNoCode } from './utils.js'
|
12
4
|
const tops = []
|
package/src/plain/tokeniser.js
CHANGED
@@ -114,7 +114,7 @@ const keywords = {
|
|
114
114
|
for (let i = 0; i < props.length; ++i) {
|
115
115
|
Object.defineProperty(localEnv, params[i][VALUE], {
|
116
116
|
value: evaluate(props[i], scope),
|
117
|
-
writable: true
|
117
|
+
writable: true
|
118
118
|
})
|
119
119
|
}
|
120
120
|
return evaluate(body, localEnv)
|
@@ -177,7 +177,7 @@ const keywords = {
|
|
177
177
|
name = word[VALUE]
|
178
178
|
Object.defineProperty(env, name, {
|
179
179
|
value: evaluate(args[1], env),
|
180
|
-
writable: false
|
180
|
+
writable: false
|
181
181
|
})
|
182
182
|
return env[name]
|
183
183
|
},
|
@@ -269,7 +269,7 @@ const keywords = {
|
|
269
269
|
for (let i = 0; i < props.length; ++i) {
|
270
270
|
Object.defineProperty(localEnv, params[i][VALUE], {
|
271
271
|
value: evaluate(props[i], scope),
|
272
|
-
writable: true
|
272
|
+
writable: true
|
273
273
|
})
|
274
274
|
}
|
275
275
|
return evaluate(body, localEnv)
|
@@ -295,7 +295,6 @@ const keywords = {
|
|
295
295
|
? console.log(
|
296
296
|
'\x1b[31m',
|
297
297
|
`${describe} Failed:\n`,
|
298
|
-
|
299
298
|
`${rest[0]} => ${stringify(rest[1])} != ${stringify(rest[2])}`,
|
300
299
|
'\n',
|
301
300
|
'\x1b[0m'
|
@@ -341,7 +340,7 @@ const keywords = {
|
|
341
340
|
[KEYWORDS.CLEAR_CONSOLE]: (args) => {
|
342
341
|
console.clear()
|
343
342
|
return 0
|
344
|
-
}
|
343
|
+
}
|
345
344
|
}
|
346
345
|
keywords[KEYWORDS.NOT_COMPILED_BLOCK] = keywords[KEYWORDS.BLOCK]
|
347
346
|
keywords[KEYWORDS.DOC] = (args, env) => {
|
package/src/tokeniser.js
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
isEqual,
|
7
7
|
isEqualTypes,
|
8
8
|
isForbiddenVariableName,
|
9
|
-
stringifyArgs
|
9
|
+
stringifyArgs
|
10
10
|
} from './utils.js'
|
11
11
|
|
12
12
|
const keywords = {
|
@@ -405,7 +405,7 @@ const keywords = {
|
|
405
405
|
for (let i = 0; i < props.length; ++i) {
|
406
406
|
Object.defineProperty(localEnv, params[i][VALUE], {
|
407
407
|
value: evaluate(props[i], scope),
|
408
|
-
writable: true
|
408
|
+
writable: true
|
409
409
|
})
|
410
410
|
}
|
411
411
|
return evaluate(body, localEnv)
|
@@ -631,7 +631,7 @@ const keywords = {
|
|
631
631
|
name = word[VALUE]
|
632
632
|
Object.defineProperty(env, name, {
|
633
633
|
value: evaluate(args[1], env),
|
634
|
-
writable: false
|
634
|
+
writable: false
|
635
635
|
})
|
636
636
|
return env[name]
|
637
637
|
},
|
@@ -931,7 +931,7 @@ const keywords = {
|
|
931
931
|
for (let i = 0; i < props.length; ++i) {
|
932
932
|
Object.defineProperty(localEnv, params[i][VALUE], {
|
933
933
|
value: evaluate(props[i], scope),
|
934
|
-
writable: true
|
934
|
+
writable: true
|
935
935
|
})
|
936
936
|
}
|
937
937
|
return evaluate(body, localEnv)
|
@@ -966,13 +966,22 @@ const keywords = {
|
|
966
966
|
[KEYWORDS.TEST_BED]: (args, env) => {
|
967
967
|
let tests = []
|
968
968
|
try {
|
969
|
+
if (
|
970
|
+
args.some(
|
971
|
+
([[type, car]]) => !(type === APPLY && car === KEYWORDS.TEST_CASE)
|
972
|
+
)
|
973
|
+
)
|
974
|
+
throw new TypeError(
|
975
|
+
`Arguments of (${KEYWORDS.TEST_BED}) must be (${
|
976
|
+
KEYWORDS.TEST_CASE
|
977
|
+
}) (${KEYWORDS.TEST_BED} ${stringifyArgs(args)})`
|
978
|
+
)
|
969
979
|
tests = args.map((x) => evaluate(x, env))
|
970
980
|
tests.forEach(([state, describe, ...rest]) =>
|
971
981
|
!state
|
972
982
|
? console.log(
|
973
983
|
'\x1b[31m',
|
974
984
|
`${describe} Failed:\n`,
|
975
|
-
|
976
985
|
`${rest[0]} => ${stringify(rest[1])} != ${stringify(rest[2])}`,
|
977
986
|
'\n',
|
978
987
|
'\x1b[0m'
|
@@ -1090,7 +1099,7 @@ const keywords = {
|
|
1090
1099
|
)
|
1091
1100
|
console.clear()
|
1092
1101
|
return 0
|
1093
|
-
}
|
1102
|
+
}
|
1094
1103
|
}
|
1095
1104
|
keywords[KEYWORDS.NOT_COMPILED_BLOCK] = keywords[KEYWORDS.BLOCK]
|
1096
1105
|
keywords[KEYWORDS.DOC] = (args, env) => {
|
package/src/utils.js
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
import std from '../lib/baked/std.js'
|
2
2
|
import { comp } from './compiler.js'
|
3
|
-
import {
|
4
|
-
APPLY,
|
5
|
-
ATOM,
|
6
|
-
KEYWORDS,
|
7
|
-
PLACEHOLDER,
|
8
|
-
TYPE,
|
9
|
-
VALUE,
|
10
|
-
WORD,
|
11
|
-
} from './enums.js'
|
3
|
+
import { APPLY, KEYWORDS, TYPE, VALUE, WORD } from './enums.js'
|
12
4
|
import { run } from './interpreter.js'
|
13
5
|
import { run as runPlain } from './plain/interpreter.js'
|
14
6
|
import { isLeaf, parse } from './parser.js'
|
@@ -16,7 +8,8 @@ export const logError = (error) => console.log('\x1b[31m', error, '\x1b[0m')
|
|
16
8
|
export const logSuccess = (output) => console.log(output, '\x1b[0m')
|
17
9
|
export const removeNoCode = (source) =>
|
18
10
|
source
|
19
|
-
.replace(/;.+/g, '')
|
11
|
+
// .replace(/;.+/g, '')
|
12
|
+
.replace(/;(?=(?:(?:[^"]*"){2})*[^"]*$).+/g, '')
|
20
13
|
.replace(/[\s\s]+(?=[^"]*(?:"[^"]*"[^"]*)*$)/g, ' ')
|
21
14
|
.trim()
|
22
15
|
export const isBalancedParenthesis = (sourceCode) => {
|
@@ -217,10 +210,9 @@ export const earMuffsToLodashes = (name) => name.replace(new RegExp(/\*/g), '_')
|
|
217
210
|
export const dotNamesToEmpty = (name) => name.replace(new RegExp(/\./g), '')
|
218
211
|
export const colonNamesTo$ = (name) => name.replace(new RegExp(/\:/g), '$')
|
219
212
|
export const commaToLodash = (name) => name.replace(new RegExp(/\,/g), '_')
|
220
|
-
export const
|
213
|
+
export const arrowFromTo = (name) => name.replace(new RegExp(/->/g), '-to-')
|
221
214
|
export const moduleNameToLodashes = (name) =>
|
222
215
|
name.replace(new RegExp(/:/g), '_')
|
223
|
-
|
224
216
|
export const questionMarkToLodash = (name) =>
|
225
217
|
name.replace(new RegExp(/\?/g), 'Predicate')
|
226
218
|
export const exclamationMarkMarkToLodash = (name) =>
|
@@ -303,7 +295,7 @@ export const decompress = (raw) => {
|
|
303
295
|
export const shake = (parsed, std) => [...treeShake(parsed, std), ...parsed]
|
304
296
|
export const lispToJavaScriptVariableName = (name) =>
|
305
297
|
toCamelCase(
|
306
|
-
|
298
|
+
arrowFromTo(
|
307
299
|
dotNamesToEmpty(
|
308
300
|
colonNamesTo$(
|
309
301
|
exclamationMarkMarkToLodash(
|