fez-lisp 1.0.31 → 1.0.33
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 +1 -1
- package/src/compiler.js +145 -112
- package/src/formatter.js +1 -9
- package/src/utils.js +28 -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:ascending?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,">"],[1,"a"],[1,"b"]]]],[[0,"let"],[1,"math:descending?"],[[0,"lambda"],[1,"a"],[1,"b"],[[0,"<"],[1,"a"],[1,"b"]]]],[[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,"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,"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,"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,"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,"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,"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: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,"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,"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: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"],[1,"items"],[[0,"set:add!"],[[0,"array"],[],[],[],[]],[1,"items"]]]],[[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,"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,"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,"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,"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
package/src/compiler.js
CHANGED
@@ -10,27 +10,54 @@ import {
|
|
10
10
|
import { leaf, isLeaf } from './parser.js'
|
11
11
|
import { deepRename, lispToJavaScriptVariableName } from './utils.js'
|
12
12
|
const Helpers = {
|
13
|
-
|
14
|
-
|
13
|
+
__add: `__add=(...numbers)=>{return numbers.reduce((a,b)=>a+b,0)}`,
|
14
|
+
__sub: `__sub=(...numbers)=>{return numbers.reduce((a,b)=>a-b,0)}`,
|
15
|
+
__mult: `__mult=(...numbers)=>{return numbers.reduce((a,b)=>a*b,1)}`,
|
16
|
+
__gteq: '__gteq=(a,b)=>+(a>=b)',
|
17
|
+
__gt: '__gt=(a,b)=>+(a>b)',
|
18
|
+
__eq: '__eq=(a,b)=>+(a===b)',
|
19
|
+
__lteq: '__lteq=(a,b)=>+(a<=b)',
|
20
|
+
__lt: '__lt=(a,b)=>+(a<b)',
|
21
|
+
not: 'not=(a)=>+!a',
|
22
|
+
and: `and=(...args)=>{
|
23
|
+
let circuit
|
24
|
+
for (let i = 0; i < args.length - 1; ++i) {
|
25
|
+
circuit = args[i]
|
26
|
+
if (circuit) continue
|
27
|
+
else return circuit
|
28
|
+
}
|
29
|
+
return args.at(-1)
|
30
|
+
}`,
|
31
|
+
or: `and=(...args)=>{
|
32
|
+
let circuit
|
33
|
+
for (let i = 0; i < args.length - 1; ++i) {
|
34
|
+
circuit = args[i]
|
35
|
+
if (circuit) return circuit
|
36
|
+
else continue
|
37
|
+
}
|
38
|
+
return args.at(-1)
|
39
|
+
}`,
|
40
|
+
logEffect: `logEffect=(msg)=>{console.log(msg);return msg}`,
|
41
|
+
clearEffect: `clearEffect=()=>{console.clear();return 0}`,
|
15
42
|
array_merge: `array_merge=(...arrays)=>arrays.reduce((a,b)=>a.concat(b),[])`,
|
16
43
|
car: 'car=(arr)=>arr.at(0)',
|
17
44
|
cdr: 'cdr=(arr)=>arr.slice(1)',
|
18
45
|
array_get: 'array_get=(arr,i)=>arr.at(i)',
|
19
46
|
length: 'length=(arr)=>arr.length',
|
20
|
-
|
47
|
+
__tco: `__tco=fn=>(...args)=>{
|
21
48
|
let result=fn(...args)
|
22
49
|
while(typeof result==='function')result=result()
|
23
50
|
return result
|
24
51
|
}`,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
error: `
|
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
|
+
error: `error=(error)=>{
|
31
58
|
throw new Error(error)
|
32
59
|
}`,
|
33
|
-
|
60
|
+
array_setEffect: `array_setEffect=(array,index,value)=>{
|
34
61
|
if (index < 0) {
|
35
62
|
const target = array.length + index
|
36
63
|
while (array.length !== target) array.pop()
|
@@ -38,8 +65,8 @@ return result
|
|
38
65
|
return array
|
39
66
|
}`,
|
40
67
|
serialise:
|
41
|
-
"serialise=(ast)=>{\n if(ast==undefined) return '()'\n else if(typeof ast==='object')\n if(Array.isArray(ast)) return `(array ${ast.map(
|
42
|
-
cast: `
|
68
|
+
"serialise=(ast)=>{\n if(ast==undefined) return '()'\n else if(typeof ast==='object')\n if(Array.isArray(ast)) return `(array ${ast.map(serialise).join(' ')})`\n else\n return `(array ${ast.map(([key, value]) => `(\"${key}\" ${serialise(value)})`).join(' ')})`\n else if(typeof ast==='string') return `\"${ast}\"`\n else if(typeof ast==='function') return '()'\n else return ast\n}",
|
69
|
+
cast: `cast=(type,value)=>{
|
43
70
|
switch (type) {
|
44
71
|
case '${KEYWORDS.NUMBER_TYPE}':
|
45
72
|
return Number(value)
|
@@ -60,7 +87,6 @@ return result
|
|
60
87
|
}
|
61
88
|
}`,
|
62
89
|
}
|
63
|
-
const handleBoolean = (source) => `+${source}`
|
64
90
|
const semiColumnEdgeCases = new Set([
|
65
91
|
';)',
|
66
92
|
';-',
|
@@ -82,11 +108,10 @@ const semiColumnEdgeCases = new Set([
|
|
82
108
|
';]',
|
83
109
|
])
|
84
110
|
|
85
|
-
const parse = (Arguments,
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
const compile = (tree, Variables) => {
|
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) => {
|
90
115
|
if (!tree) return ''
|
91
116
|
const [first, ...Arguments] = !isLeaf(tree) ? tree : [tree]
|
92
117
|
if (first == undefined) return '[];'
|
@@ -96,51 +121,47 @@ const compile = (tree, Variables) => {
|
|
96
121
|
case KEYWORDS.BLOCK: {
|
97
122
|
if (Arguments.length > 1) {
|
98
123
|
return `(${Arguments.map((x) =>
|
99
|
-
(compile(x,
|
124
|
+
(compile(x, Drill) ?? '').toString().trimStart()
|
100
125
|
)
|
101
126
|
.filter(Boolean)
|
102
127
|
.join(',')});`
|
103
128
|
} else {
|
104
|
-
const res = compile(Arguments[0],
|
129
|
+
const res = compile(Arguments[0], Drill)
|
105
130
|
return res !== undefined ? res.toString().trim() : ''
|
106
131
|
}
|
107
132
|
}
|
108
133
|
case KEYWORDS.CALL_FUNCTION: {
|
109
134
|
const [first, ...rest] = Arguments
|
110
|
-
const apply = compile(first,
|
135
|
+
const apply = compile(first, Drill)
|
111
136
|
return `${
|
112
137
|
apply[apply.length - 1] === ';'
|
113
138
|
? apply.substring(0, apply.length - 1)
|
114
139
|
: apply
|
115
|
-
}(${parseArgs(rest,
|
140
|
+
}(${parseArgs(rest, Drill)})`
|
116
141
|
}
|
117
142
|
case KEYWORDS.DEFINE_VARIABLE: {
|
118
143
|
let name,
|
119
144
|
out = '(('
|
120
145
|
if (Arguments[0][TYPE] === WORD) {
|
121
146
|
name = lispToJavaScriptVariableName(Arguments[0][VALUE])
|
122
|
-
Variables.add(name)
|
147
|
+
Drill.Variables.add(name)
|
123
148
|
}
|
124
|
-
out += `${name}=${compile(Arguments[1],
|
149
|
+
out += `${name}=${compile(Arguments[1], Drill)}`
|
125
150
|
out += `),${name});`
|
126
151
|
return out
|
127
152
|
}
|
128
153
|
case KEYWORDS.IS_STRING:
|
129
|
-
|
130
|
-
|
131
|
-
)
|
154
|
+
Drill.Helpers.add('stringPredicate')
|
155
|
+
return `stringPredicate(${compile(Arguments[0], Drill)});`
|
132
156
|
case KEYWORDS.IS_NUMBER:
|
133
|
-
|
134
|
-
|
135
|
-
)
|
157
|
+
Drill.Helpers.add('numberPredicate')
|
158
|
+
return `numberPredicate(${compile(Arguments[0], Drill)});`
|
136
159
|
case KEYWORDS.IS_FUNCTION:
|
137
|
-
|
138
|
-
|
139
|
-
)
|
160
|
+
Drill.Helpers.add('lambdaPredicate')
|
161
|
+
return `lambdaPredicate(${compile(Arguments[0], Drill)});`
|
140
162
|
case KEYWORDS.IS_ARRAY:
|
141
|
-
|
142
|
-
|
143
|
-
)
|
163
|
+
Drill.Helpers.add('arrayPredicate')
|
164
|
+
return `arrayPredicate(${compile(Arguments[0], Drill)});`
|
144
165
|
case KEYWORDS.NUMBER_TYPE:
|
145
166
|
return '0'
|
146
167
|
case KEYWORDS.BOOLEAN_TYPE:
|
@@ -151,38 +172,44 @@ const compile = (tree, Variables) => {
|
|
151
172
|
return Arguments.length === 2 &&
|
152
173
|
Arguments[1][TYPE] === WORD &&
|
153
174
|
Arguments[1][VALUE] === 'length'
|
154
|
-
? `(new Array(${compile(Arguments[0],
|
155
|
-
: `[${parseArgs(Arguments,
|
175
|
+
? `(new Array(${compile(Arguments[0], Drill)}).fill(0))`
|
176
|
+
: `[${parseArgs(Arguments, Drill)}];`
|
156
177
|
case KEYWORDS.ARRAY_OR_STRING_LENGTH:
|
157
|
-
|
178
|
+
Drill.Helpers.add('length')
|
179
|
+
return `length(${compile(Arguments[0], Drill)})`
|
158
180
|
case KEYWORDS.IS_ATOM:
|
159
|
-
|
160
|
-
|
161
|
-
)
|
181
|
+
Drill.Helpers.add('atomPredicate')
|
182
|
+
return `atomPredicate(${compile(Arguments[0], Drill)});`
|
162
183
|
case KEYWORDS.FIRST_ARRAY:
|
163
|
-
|
184
|
+
Drill.Helpers.add('car')
|
185
|
+
return `car(${compile(Arguments[0], Drill)});`
|
164
186
|
case KEYWORDS.REST_ARRAY:
|
165
|
-
|
187
|
+
Drill.Helpers.add('cdr')
|
188
|
+
return `cdr(${compile(Arguments[0], Drill)});`
|
166
189
|
case KEYWORDS.GET_ARRAY:
|
167
|
-
|
190
|
+
Drill.Helpers.add('array_get')
|
191
|
+
return `array_get(${compile(Arguments[0], Drill)}, ${compile(
|
168
192
|
Arguments[1],
|
169
|
-
|
193
|
+
Drill
|
170
194
|
)});`
|
171
195
|
case KEYWORDS.MERGE:
|
172
|
-
|
196
|
+
Drill.Helpers.add('array_merge')
|
197
|
+
return `array_merge(${parseArgs(Arguments, Drill)});`
|
173
198
|
case KEYWORDS.ANONYMOUS_FUNCTION: {
|
174
199
|
const functionArgs = Arguments
|
175
200
|
const body = Arguments.pop()
|
176
|
-
const
|
177
|
-
const evaluatedBody = compile(body,
|
178
|
-
const vars = Variables.size
|
201
|
+
const InnerDrills = { Variables: new Set(), Helpers: Drill.Helpers }
|
202
|
+
const evaluatedBody = compile(body, InnerDrills)
|
203
|
+
const vars = InnerDrills.Variables.size
|
204
|
+
? `var ${[...InnerDrills.Variables].join(',')};`
|
205
|
+
: ''
|
179
206
|
return `((${parseArgs(
|
180
207
|
functionArgs.map((node, index) =>
|
181
208
|
node[VALUE] === PLACEHOLDER
|
182
209
|
? leaf(node[TYPE], `_${index}`)
|
183
210
|
: leaf(node[TYPE], node[VALUE])
|
184
211
|
),
|
185
|
-
|
212
|
+
InnerDrills
|
186
213
|
)})=>{${vars}return ${evaluatedBody.toString().trimStart()}});`
|
187
214
|
}
|
188
215
|
case KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION: {
|
@@ -192,56 +219,57 @@ const compile = (tree, Variables) => {
|
|
192
219
|
const arg = Arguments[0]
|
193
220
|
name = lispToJavaScriptVariableName(arg[VALUE])
|
194
221
|
newName = `rec_${performance.now().toString().replace('.', 7)}`
|
195
|
-
Variables.add(name)
|
196
|
-
Variables.add(newName)
|
222
|
+
Drill.Variables.add(name)
|
223
|
+
Drill.Variables.add(newName)
|
224
|
+
Drill.Helpers.add('__tco')
|
197
225
|
const functionArgs = Arguments[1].slice(1)
|
198
226
|
const body = functionArgs.pop()
|
199
|
-
const
|
227
|
+
const FunctionDrill = { Variables: new Set(), Helpers: Drill.Helpers }
|
200
228
|
deepRename(arg[VALUE], newName, body)
|
201
|
-
const evaluatedBody = compile(body,
|
202
|
-
const vars =
|
203
|
-
? `var ${[...
|
229
|
+
const evaluatedBody = compile(body, FunctionDrill)
|
230
|
+
const vars = FunctionDrill.Variables.size
|
231
|
+
? `var ${[...FunctionDrill.Variables].join(',')};`
|
204
232
|
: ''
|
205
|
-
out += `${name}=(
|
233
|
+
out += `${name}=(__tco(${newName}=(${parseArgs(
|
206
234
|
functionArgs,
|
207
|
-
|
235
|
+
Drill
|
208
236
|
)})=>{${vars}return ${evaluatedBody.toString().trimStart()}};`
|
209
237
|
out += `, ${newName}))), ${name});`
|
210
238
|
return out
|
211
239
|
}
|
212
240
|
case KEYWORDS.AND:
|
213
|
-
return `(${parseArgs(Arguments,
|
241
|
+
return `(${parseArgs(Arguments, Drill, '&&')});`
|
214
242
|
case KEYWORDS.OR:
|
215
|
-
return `((${parseArgs(Arguments,
|
243
|
+
return `((${parseArgs(Arguments, Drill, '||')}) || 0);`
|
216
244
|
case KEYWORDS.CONCATENATION:
|
217
|
-
return '(' + parseArgs(Arguments,
|
245
|
+
return '(' + parseArgs(Arguments, Drill, '+') + ');'
|
218
246
|
case KEYWORDS.EQUAL:
|
219
|
-
return
|
247
|
+
return `+(${parseArgs(Arguments, Drill, '===')});`
|
220
248
|
case KEYWORDS.GREATHER_THAN_OR_EQUAL:
|
221
249
|
case KEYWORDS.LESS_THAN_OR_EQUAL:
|
222
250
|
case KEYWORDS.GREATHER_THAN:
|
223
251
|
case KEYWORDS.LESS_THAN:
|
224
|
-
return
|
252
|
+
return `+(${parseArgs(Arguments, Drill, token)});`
|
225
253
|
case KEYWORDS.SUBTRACTION:
|
226
254
|
return Arguments.length === 1
|
227
|
-
? `(-${compile(Arguments[0],
|
228
|
-
: `(${parse(Arguments,
|
255
|
+
? `(-${compile(Arguments[0], Drill)});`
|
256
|
+
: `(${parse(Arguments, Drill)
|
229
257
|
// Add space so it doesn't consider it 2--1 but 2- -1
|
230
258
|
.map((x) => (typeof x === 'number' && x < 0 ? ` ${x}` : x))
|
231
259
|
.join(token)});`
|
232
260
|
case KEYWORDS.MULTIPLICATION:
|
233
261
|
return Arguments.length
|
234
|
-
? `(${parseArgs(Arguments,
|
262
|
+
? `(${parseArgs(Arguments, Drill, token)});`
|
235
263
|
: `(1);`
|
236
264
|
case KEYWORDS.DIVISION:
|
237
265
|
return Arguments.length
|
238
266
|
? Arguments.length === 1
|
239
|
-
? `(1/${compile(Arguments[0],
|
240
|
-
: `(${parseArgs(Arguments,
|
267
|
+
? `(1/${compile(Arguments[0], Drill)});`
|
268
|
+
: `(${parseArgs(Arguments, Drill, token)});`
|
241
269
|
: `(0);`
|
242
270
|
case KEYWORDS.ADDITION:
|
243
271
|
return Arguments.length
|
244
|
-
? `(${parseArgs(Arguments,
|
272
|
+
? `(${parseArgs(Arguments, Drill, token)});`
|
245
273
|
: `(0);`
|
246
274
|
case KEYWORDS.BITWISE_AND:
|
247
275
|
case KEYWORDS.BITWISE_OR:
|
@@ -249,74 +277,71 @@ const compile = (tree, Variables) => {
|
|
249
277
|
case KEYWORDS.BITWISE_LEFT_SHIFT:
|
250
278
|
case KEYWORDS.BITWISE_RIGHT_SHIFT:
|
251
279
|
case KEYWORDS.BITWISE_UNSIGNED_RIGHT_SHIFT:
|
252
|
-
return `(${parseArgs(Arguments,
|
280
|
+
return `(${parseArgs(Arguments, Drill, token)});`
|
253
281
|
case KEYWORDS.REMAINDER_OF_DIVISION:
|
254
|
-
return `(${compile(Arguments[0],
|
282
|
+
return `(${compile(Arguments[0], Drill)}%${compile(
|
255
283
|
Arguments[1],
|
256
|
-
|
284
|
+
Drill
|
257
285
|
)});`
|
258
286
|
case KEYWORDS.BIT_TYPE:
|
259
|
-
return `(${compile(Arguments[0],
|
287
|
+
return `(${compile(Arguments[0], Drill)}>>>0).toString(2)`
|
260
288
|
case KEYWORDS.BITWISE_NOT:
|
261
|
-
return `~(${compile(Arguments[0],
|
289
|
+
return `~(${compile(Arguments[0], Drill)})`
|
262
290
|
case KEYWORDS.NOT:
|
263
|
-
return `(
|
291
|
+
return `(+!${compile(Arguments[0], Drill)})`
|
264
292
|
case KEYWORDS.IF: {
|
265
|
-
return `(${compile(Arguments[0],
|
293
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
266
294
|
Arguments[1],
|
267
|
-
|
268
|
-
)}:${compile(Arguments[2],
|
295
|
+
Drill
|
296
|
+
)}:${compile(Arguments[2], Drill)});`
|
269
297
|
}
|
270
298
|
case KEYWORDS.WHEN: {
|
271
|
-
return `(${compile(Arguments[0],
|
299
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
272
300
|
Arguments[1],
|
273
|
-
|
301
|
+
Drill
|
274
302
|
)}:0);`
|
275
303
|
}
|
276
304
|
case KEYWORDS.UNLESS: {
|
277
|
-
return `(${compile(Arguments[0],
|
305
|
+
return `(${compile(Arguments[0], Drill)}?${compile(
|
278
306
|
Arguments[2],
|
279
|
-
|
280
|
-
)}:${compile(Arguments[1],
|
307
|
+
Drill
|
308
|
+
)}:${compile(Arguments[1], Drill)});`
|
281
309
|
}
|
282
310
|
case KEYWORDS.OTHERWISE: {
|
283
|
-
return `(${compile(Arguments[0],
|
311
|
+
return `(${compile(Arguments[0], Drill)}?0:${compile(
|
284
312
|
Arguments[1],
|
285
|
-
|
313
|
+
Drill
|
286
314
|
)});`
|
287
315
|
}
|
288
316
|
case KEYWORDS.CONDITION: {
|
289
317
|
let out = '('
|
290
318
|
for (let i = 0; i < Arguments.length; i += 2)
|
291
|
-
out += `${compile(Arguments[i],
|
319
|
+
out += `${compile(Arguments[i], Drill)}?${compile(
|
292
320
|
Arguments[i + 1],
|
293
|
-
|
321
|
+
Drill
|
294
322
|
)}:`
|
295
323
|
out += '0);'
|
296
324
|
return out
|
297
325
|
}
|
298
326
|
case KEYWORDS.CAST_TYPE:
|
299
|
-
|
300
|
-
|
301
|
-
Variables
|
302
|
-
)})`
|
327
|
+
Drill.Helpers.add('cast')
|
328
|
+
return `cast("${Arguments[1][VALUE]}", ${compile(Arguments[0], Drill)})`
|
303
329
|
case KEYWORDS.PIPE: {
|
304
330
|
let inp = Arguments[0]
|
305
331
|
for (let i = 1; i < Arguments.length; ++i)
|
306
332
|
inp = [Arguments[i].shift(), inp, ...Arguments[i]]
|
307
|
-
return compile(inp,
|
308
|
-
}
|
309
|
-
case KEYWORDS.THROW_ERROR: {
|
310
|
-
return `_error(${compile(Arguments[0], Variables)})`
|
333
|
+
return compile(inp, Drill)
|
311
334
|
}
|
312
335
|
case KEYWORDS.IMMUTABLE_FUNCTION: {
|
313
336
|
const [first, ...rest] = Arguments
|
314
|
-
return compile([leaf(APPLY, first[VALUE]), ...rest],
|
337
|
+
return compile([leaf(APPLY, first[VALUE]), ...rest], Drill)
|
315
338
|
}
|
316
|
-
case KEYWORDS.SERIALISE:
|
317
|
-
|
318
|
-
|
319
|
-
|
339
|
+
// case KEYWORDS.SERIALISE:
|
340
|
+
// Drill.Helpers.add('serialise')
|
341
|
+
// return `serialise(${compile(Arguments[0], Drill)});`
|
342
|
+
// case KEYWORDS.SET_ARRAY:
|
343
|
+
// Drill.Helpers.add('arraySetEffect')
|
344
|
+
// return `arraySetEffect(${parseArgs(Arguments, Drill)});`
|
320
345
|
case KEYWORDS.NOT_COMPILED_BLOCK:
|
321
346
|
case KEYWORDS.ATOM:
|
322
347
|
case KEYWORDS.TEST_CASE:
|
@@ -325,22 +350,25 @@ const compile = (tree, Variables) => {
|
|
325
350
|
return ''
|
326
351
|
default: {
|
327
352
|
const camelCased = lispToJavaScriptVariableName(token)
|
328
|
-
|
353
|
+
if (camelCased in Helpers) Drill.Helpers.add(camelCased)
|
354
|
+
return `${camelCased}(${parseArgs(Arguments, Drill)});`
|
329
355
|
}
|
330
356
|
}
|
331
357
|
} else if (first[TYPE] === ATOM)
|
332
358
|
return typeof first[VALUE] === 'string'
|
333
359
|
? `\`${first[VALUE]}\``
|
334
360
|
: first[VALUE]
|
335
|
-
else if (first[TYPE] === WORD)
|
361
|
+
else if (first[TYPE] === WORD) {
|
362
|
+
const camelCased = lispToJavaScriptVariableName(token)
|
363
|
+
if (camelCased in Helpers) Drill.Helpers.add(camelCased)
|
364
|
+
return camelCased
|
365
|
+
}
|
336
366
|
}
|
337
|
-
|
338
|
-
const HelperSources = Object.values(Helpers).join(',')
|
339
|
-
|
367
|
+
const HelpersEntries = new Map(Object.entries(Helpers))
|
340
368
|
export const comp = (ast) => {
|
341
|
-
const
|
369
|
+
const Drill = { Variables: new Set(), Helpers: new Set() }
|
342
370
|
const raw = ast
|
343
|
-
.map((tree) => compile(tree,
|
371
|
+
.map((tree) => compile(tree, Drill))
|
344
372
|
.filter(Boolean)
|
345
373
|
.join('\n')
|
346
374
|
let program = ''
|
@@ -349,9 +377,14 @@ export const comp = (ast) => {
|
|
349
377
|
const next = raw[i + 1]
|
350
378
|
if (!semiColumnEdgeCases.has(current + next)) program += current
|
351
379
|
}
|
352
|
-
const
|
353
|
-
|
354
|
-
|
355
|
-
|
380
|
+
const help = Drill.Helpers.size
|
381
|
+
? `var ${[...Drill.Helpers.keys()]
|
382
|
+
.map((x) => HelpersEntries.get(x))
|
383
|
+
.join(',')};\n`
|
384
|
+
: ''
|
385
|
+
const vars = Drill.Variables.size
|
386
|
+
? `var ${[...Drill.Variables].join(',')};`
|
387
|
+
: ''
|
388
|
+
const top = `${help}${vars}`
|
356
389
|
return { top, program }
|
357
390
|
}
|
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/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'
|
@@ -217,10 +209,9 @@ export const earMuffsToLodashes = (name) => name.replace(new RegExp(/\*/g), '_')
|
|
217
209
|
export const dotNamesToEmpty = (name) => name.replace(new RegExp(/\./g), '')
|
218
210
|
export const colonNamesTo$ = (name) => name.replace(new RegExp(/\:/g), '$')
|
219
211
|
export const commaToLodash = (name) => name.replace(new RegExp(/\,/g), '_')
|
220
|
-
export const
|
212
|
+
export const arrowFromTo = (name) => name.replace(new RegExp(/->/g), '-to-')
|
221
213
|
export const moduleNameToLodashes = (name) =>
|
222
214
|
name.replace(new RegExp(/:/g), '_')
|
223
|
-
|
224
215
|
export const questionMarkToLodash = (name) =>
|
225
216
|
name.replace(new RegExp(/\?/g), 'Predicate')
|
226
217
|
export const exclamationMarkMarkToLodash = (name) =>
|
@@ -236,6 +227,28 @@ export const toCamelCase = (name) => {
|
|
236
227
|
}
|
237
228
|
return out
|
238
229
|
}
|
230
|
+
export const keywordToHelper = (name) => {
|
231
|
+
switch (name) {
|
232
|
+
case KEYWORDS.ADDITION:
|
233
|
+
return '__add'
|
234
|
+
case KEYWORDS.MULTIPLICATION:
|
235
|
+
return '__mult'
|
236
|
+
case KEYWORDS.SUBTRACTION:
|
237
|
+
return '__sub'
|
238
|
+
case KEYWORDS.GREATHER_THAN:
|
239
|
+
return '__gt'
|
240
|
+
case KEYWORDS.EQUAL:
|
241
|
+
return '__eq'
|
242
|
+
case KEYWORDS.GREATHER_THAN_OR_EQUAL:
|
243
|
+
return '__gteq'
|
244
|
+
case KEYWORDS.LESS_THAN:
|
245
|
+
return '__lt'
|
246
|
+
case KEYWORDS.LESS_THAN_OR_EQUAL:
|
247
|
+
return '__lteq'
|
248
|
+
default:
|
249
|
+
return name
|
250
|
+
}
|
251
|
+
}
|
239
252
|
export const deepRename = (name, newName, tree) => {
|
240
253
|
if (!isLeaf(tree))
|
241
254
|
for (const leaf of tree) {
|
@@ -281,12 +294,14 @@ export const decompress = (raw) => {
|
|
281
294
|
export const shake = (parsed, std) => [...treeShake(parsed, std), ...parsed]
|
282
295
|
export const lispToJavaScriptVariableName = (name) =>
|
283
296
|
toCamelCase(
|
284
|
-
|
297
|
+
arrowFromTo(
|
285
298
|
dotNamesToEmpty(
|
286
299
|
colonNamesTo$(
|
287
300
|
exclamationMarkMarkToLodash(
|
288
301
|
questionMarkToLodash(
|
289
|
-
commaToLodash(
|
302
|
+
commaToLodash(
|
303
|
+
moduleNameToLodashes(earMuffsToLodashes(keywordToHelper(name)))
|
304
|
+
)
|
290
305
|
)
|
291
306
|
)
|
292
307
|
)
|