fez-lisp 1.0.23 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 AT-290690
3
+ Copyright (c) 2024 AT-290690
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -120,3 +120,28 @@ fez(
120
120
  { std: true, errors: true, compile: false, shake: true }
121
121
  )
122
122
  ```
123
+
124
+ Tail Call Optimization:
125
+
126
+ There are no loop constructs (like a "for" or "while" loop in other languages).
127
+ That's because we don't quite need one: looping in fez is done by recursion — and the interpreter already supports that.
128
+ But because each procedure call calls evaluate, recursing over a large number of items blows up the call stack of the interpreter.
129
+
130
+ This optimization technique works only by declaring the variable with let\*
131
+ and only when compiled to JavaScript.
132
+
133
+ ```lisp
134
+ (let* sum-to (lambda n acc (if (= n 0) acc (sum-to (- n 1) (+ n acc)))))
135
+ (sum-to 10000 0)
136
+ ```
137
+
138
+ ```js
139
+ console.log(
140
+ fez(
141
+ `(let* sum-to (lambda n acc (if (= n 0) acc (sum-to (- n 1) (+ n acc)))))
142
+ (sum-to 10000 0)`,
143
+ { compile: 1, eval: 1 }
144
+ )
145
+ )
146
+ // 50005000
147
+ ```
package/lib/baked/std.js CHANGED
@@ -1 +1 @@
1
- export default [[["f","let"],["w","math:E"],["a",2.718281828459045]],[["f","let"],["w","math:PI"],["a",3.141592653589793]],[["f","let*"],["w","array:for"],[["f","lambda"],["w","arr"],["w","callback"],[["f","when"],[["f","length"],["w","arr"]],[["f","do"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","array:for"],[["f","cdr"],["w","arr"]],["w","callback"]]]]]],[["f","let"],["w","array:map"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","callback"],[["f","car"],["w","arr"]]]]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:select"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","car"],["w","arr"]]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:exclude"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","if"],[["f","not"],[["f","callback"],[["f","car"],["w","arr"]]]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","car"],["w","arr"]]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:fold"],[["f","lambda"],["w","arr"],["w","callback"],["w","initial"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","callback"],["w","out"],[["f","car"],["w","arr"]]]],["w","out"]]]],[["f","iterate"],["w","arr"],["w","initial"]]]]],[["f","let"],["w","array:every?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","and"],[["f","length"],["w","arr"]],[["f","callback"],[["f","car"],["w","arr"]]]],[["f","iterate"],[["f","cdr"],["w","arr"]]],[["f","not"],[["f","length"],["w","arr"]]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:some?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","and"],[["f","length"],["w","arr"]],[["f","not"],[["f","callback"],[["f","car"],["w","arr"]]]]],[["f","iterate"],[["f","cdr"],["w","arr"]]],[["f","type"],[["f","length"],["w","arr"]],["w","boolean"]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:find"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","car"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]]]],[]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:has?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","when"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],["a",1],[["f","iterate"],[["f","cdr"],["w","arr"]]]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:reverse"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","array:merge!"],[["f","array"],[["f","car"],["w","arr"]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","math:range"],[["f","lambda"],["w","start"],["w","end"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<="],["w","count"],["w","end"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["w","start"]]]]],[["f","let"],["w","math:sequence"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let"],["w","end"],[["f","length"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<"],[["f","length"],["w","out"]],["w","end"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["a",0]]]]],[["f","let"],["w","math:sequence-n"],[["f","lambda"],["w","n"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<"],[["f","length"],["w","out"]],["w","n"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["a",0]]]]],[["f","let"],["w","array:unique"],[["f","lambda"],["w","arr"],[["f","pi"],[["f","let"],["w","sorted"],[["f","array:sort"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">"],["w","a"],["w","b"]]]]],[["f","array:zip"],[["f","math:sequence"],["w","sorted"]]],[["f","array:select"],[["f","lambda"],["w","x"],[["f","or"],[["f","not"],[["f","let"],["w","index"],[["f","car"],[["f","cdr"],["w","x"]]]]],[["f","not"],[["f","="],[["f","array:get"],["w","sorted"],[["f","-"],["w","index"],["a",1]]],[["f","array:get"],["w","sorted"],["w","index"]]]]]]],[["f","array:map"],["w","car"]]]]],[["f","let"],["w","array:for-range"],[["f","lambda"],["w","start"],["w","end"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],[["f","when"],[["f","<"],["w","i"],["w","end"]],[["f","do"],[["f","callback"],["w","i"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]]]]]]],[["f","iterate"],["w","start"]]]]],[["f","let"],["w","array:traverse"],[["f","lambda"],["w","x"],["w","callback"],[["f","if"],[["f","atom?"],["w","x"]],[["f","callback"],["w","x"]],[["f","iterate"],["w","x"],[["f","lambda"],["w","y"],[["f","array:traverse"],["w","y"],["w","callback"]]]]]]],[["f","let"],["w","math:summation"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","+"],["w","a"],["w","b"]]],[["f","+"]]]]],[["f","let"],["w","math:product"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","*"],["w","a"],["w","b"]]],[["f","*"]]]]],[["f","let"],["w","math:maximum"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],["w","a"],["w","b"]],["w","a"],["w","b"]]],[["f","car"],["w","arr"]]]]],[["f","let"],["w","math:minimum"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","if"],[["f","<"],["w","a"],["w","b"]],["w","a"],["w","b"]]],[["f","car"],["w","arr"]]]]],[["f","let"],["w","math:max"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],["w","a"],["w","b"]],["w","a"],["w","b"]]]],[["f","let"],["w","math:min"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","<"],["w","a"],["w","b"]],["w","a"],["w","b"]]]],[["f","let"],["w","array:count-of"],[["f","lambda"],["w","arr"],["w","callback"],[["f","pi"],["w","arr"],[["f","array:select"],["w","callback"]],[["f","length"]]]]],[["f","let"],["w","math:increment"],[["f","safety"],["w","lambda"],["w","i"],[["f","+"],["w","i"],["a",1]]]],[["f","let"],["w","math:floor"],[["f","safety"],["w","lambda"],["w","n"],[["f","|"],["w","n"],["a",0]]]],[["f","let"],["w","math:round"],[["f","safety"],["w","lambda"],["w","n"],[["f","|"],[["f","+"],["w","n"],["a",0.5]],["a",0]]]],[["f","let"],["w","array:empty?"],[["f","safety"],["w","lambda"],["w","arr"],[["f","not"],[["f","length"],["w","arr"]]]]],[["f","let"],["w","array:empty!"],[["f","safety"],["w","lambda"],["w","arr"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],[["f","if"],[["f","length"],["w","arr"]],[["f","do"],[["f","array:set!"],["w","arr"],["a",-1]],[["f","iterate"]]],["w","arr"]]]],[["f","iterate"]]]]],[["f","let"],["w","array:in-bounds?"],[["f","safety"],["w","lambda"],["w","arr"],["w","index"],[["f","and"],[["f","<"],["w","index"],[["f","length"],["w","arr"]]],[["f",">="],["w","index"],["a",0]]]]],[["f","let"],["w","math:largest-power"],[["f","safety"],["w","lambda"],["w","N"],[["f","do"],[["f","let"],["w","N1"],[["f","|"],["w","N"],[["f",">>"],["w","N"],["a",1]]]],[["f","let"],["w","N2"],[["f","|"],["w","N1"],[["f",">>"],["w","N1"],["a",2]]]],[["f","let"],["w","N3"],[["f","|"],["w","N2"],[["f",">>"],["w","N2"],["a",4]]]],[["f","let"],["w","N4"],[["f","|"],["w","N3"],[["f",">>"],["w","N3"],["a",8]]]],[["f",">>"],[["f","+"],["w","N4"],["a",1]],["a",1]]]]],[["f","let"],["w","math:set-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","bit"],[["f","|"],["w","n"],[["f","<<"],["a",1],["w","bit"]]]]],[["f","let"],["w","math:clear-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","bit"],[["f","&"],["w","n"],[["f","~"],[["f","<<"],["a",1],["w","bit"]]]]]],[["f","let"],["w","math:odd-bit?"],[["f","safety"],["w","lambda"],["w","n"],[["f","="],[["f","&"],["w","n"],["a",1]],["a",1]]]],[["f","let"],["w","math:average-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">>"],[["f","+"],["w","a"],["w","b"]],["a",1]]]],[["f","let"],["w","math:toggle-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","a"],["w","b"],[["f","^"],["w","a"],["w","b"],["w","n"]]]],[["f","let"],["w","math:same-sign-bit?"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">="],[["f","^"],["w","a"],["w","b"]],["a",0]]]],[["f","let"],["w","math:max-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","-"],["w","a"],[["f","&"],[["f","-"],["w","a"],["w","b"]],[["f",">>"],[["f","-"],["w","a"],["w","b"]],["a",31]]]]]],[["f","let"],["w","math:min-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","-"],["w","a"],[["f","&"],[["f","-"],["w","a"],["w","b"]],[["f",">>"],[["f","-"],["w","b"],["w","a"]],["a",31]]]]]],[["f","let"],["w","math:modulo-bit"],[["f","safety"],["w","lambda"],["w","numerator"],["w","divisor"],[["f","&"],["w","numerator"],[["f","-"],["w","divisor"],["a",1]]]]],[["f","let"],["w","math:n-one-bit?"],[["f","safety"],["w","lambda"],["w","N"],["w","nth"],[["f","type"],[["f","&"],["w","N"],[["f","<<"],["a",1],["w","nth"]]],["w","boolean"]]]],[["f","let"],["w","cast:string->chars"],[["f","safety"],["w","lambda"],["w","str"],[["f","type"],["w","str"],["w","array"]]]],[["f","let"],["w","cast:chars->string"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","x"],[["f","string:merge"],["w","a"],[["f","type"],["w","x"],["w","string"]]]],["a",""]]]],[["f","let"],["w","cast:string->number"],[["f","safety"],["w","lambda"],["w","str"],[["f","type"],["w","str"],["w","number"]]]],[["f","let"],["w","cast:number->string"],[["f","safety"],["w","lambda"],["w","n"],[["f","type"],["w","n"],["w","string"]]]],[["f","let"],["w","cast:strings->numbers"],[["f","lambda"],["w","arr"],[["f","array:map"],["w","arr"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","number"]]]]]],[["f","let"],["w","cast:numbers->strings"],[["f","lambda"],["w","arr"],[["f","array:map"],["w","arr"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","string"]]]]]],[["f","let"],["w","cast:string->char-codes"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char-code"]]]]]]],[["f","let"],["w","cast:chars->char-codes"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char-code"]]]]]]],[["f","let"],["w","cast:chars->numbers"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","number"]]]]]]],[["f","let"],["w","cast:char->number"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","number"]]]],[["f","let"],["w","cast:char->char-code"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","char-code"]]]],[["f","let"],["w","cast:char-code->char"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","char"]]]],[["f","let"],["w","cast:char-codes->chars"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char"]]]]]]],[["f","let"],["w","cast:char-codes->string"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char"]]]],[["f","cast:chars->string"]]]]],[["f","let"],["w","math:square"],[["f","safety"],["w","lambda"],["w","x"],[["f","*"],["w","x"],["w","x"]]]],[["f","let"],["w","math:power"],[["f","lambda"],["w","base"],["w","exp"],[["f","if"],[["f","<"],["w","exp"],["a",0]],[["f","if"],[["f","="],["w","base"],["a",0]],[["f","throw"],["a","Attempting to divide by 0 in (math:power)"]],[["f","/"],[["f","*"],["w","base"],[["f","math:power"],["w","base"],[["f","-"],[["f","*"],["w","exp"],["a",-1]],["a",1]]]]]],[["f","cond"],[["f","="],["w","exp"],["a",0]],["a",1],[["f","="],["w","exp"],["a",1]],["w","base"],[["f","*"]],[["f","*"],["w","base"],[["f","math:power"],["w","base"],[["f","-"],["w","exp"],["a",1]]]]]]]],[["f","let"],["w","math:greatest-common-divisor"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let*"],["w","gcd"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","="],["w","b"],["a",0]],["w","a"],[["f","gcd"],["w","b"],[["f","mod"],["w","a"],["w","b"]]]]]],[["f","gcd"],["w","a"],["w","b"]]]]],[["f","let"],["w","math:least-common-divisor"],[["f","lambda"],["w","a"],["w","b"],[["f","*"],["w","a"],["w","b"],[["f","/"],[["f","math:greatest-common-divisor"],["w","a"],["w","b"]]]]]],[["f","let"],["w","math:sqrt"],[["f","lambda"],["w","x"],[["f","do"],[["f","let"],["w","is-good-enough"],[["f","lambda"],["w","g"],["w","x"],[["f","<"],[["f","math:abs"],[["f","-"],[["f","math:square"],["w","g"]],["w","x"]]],["a",0.01]]]],[["f","let"],["w","improve-guess"],[["f","lambda"],["w","g"],["w","x"],[["f","math:average"],["w","g"],[["f","*"],["w","x"],[["f","/"],["w","g"]]]]]],[["f","let*"],["w","math:sqrt-iter"],[["f","lambda"],["w","g"],["w","x"],[["f","if"],[["f","is-good-enough"],["w","g"],["w","x"]],["w","g"],[["f","math:sqrt-iter"],[["f","improve-guess"],["w","g"],["w","x"]],["w","x"]]]]],[["f","math:sqrt-iter"],["a",1],["w","x"]]]]],[["f","let"],["w","math:circumference"],[["f","lambda"],["w","radius"],[["f","*"],["w","math:PI"],[["f","*"],["w","radius"],["a",2]]]]],[["f","let"],["w","math:hypotenuse"],[["f","lambda"],["w","a"],["w","b"],[["f","math:sqrt"],[["f","+"],[["f","*"],["w","a"],["w","a"]],[["f","*"],["w","b"],["w","b"]]]]]],[["f","let"],["w","math:abs"],[["f","safety"],["w","lambda"],["w","n"],[["f","-"],[["f","^"],["w","n"],[["f",">>"],["w","n"],["a",31]]],[["f",">>"],["w","n"],["a",31]]]]],[["f","let"],["w","math:nth-digit"],[["f","lambda"],["w","digit"],["w","n"],[["f","|"],[["f","mod"],[["f","/"],["w","digit"],[["f","math:power"],["a",10],[["f","-"],["w","n"],["a",1]]]],["a",10]],["a",0.5]]]],[["f","let"],["w","math:normalize"],[["f","safety"],["w","lambda"],["w","value"],["w","math:min"],["w","math:max"],[["f","*"],[["f","-"],["w","value"],["w","math:min"]],[["f","/"],[["f","-"],["w","math:max"],["w","math:min"]]]]]],[["f","let"],["w","math:linear-interpolation"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],["w","n"],[["f","+"],[["f","*"],[["f","-"],["a",1],["w","n"]],["w","a"]],[["f","*"],["w","n"],["w","b"]]]]],[["f","let"],["w","math:gauss-sum"],[["f","safety"],["w","lambda"],["w","n"],[["f","*"],["w","n"],[["f","+"],["w","n"],["a",1]],["a",0.5]]]],[["f","let"],["w","math:gauss-sum-sequance"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","*"],[["f","+"],["w","a"],["w","b"]],[["f","+"],[["f","-"],["w","b"],["w","a"]],["a",1]],["a",0.5]]]],[["f","let"],["w","math:clamp"],[["f","safety"],["w","lambda"],["w","x"],["w","limit"],[["f","if"],[["f",">"],["w","x"],["w","limit"]],["w","limit"],["w","x"]]]],[["f","let"],["w","math:odd?"],[["f","safety"],["w","lambda"],["w","x"],[["f","="],[["f","mod"],["w","x"],["a",2]],["a",1]]]],[["f","let"],["w","math:even?"],[["f","safety"],["w","lambda"],["w","x"],[["f","="],[["f","mod"],["w","x"],["a",2]],["a",0]]]],[["f","let"],["w","math:sign"],[["f","safety"],["w","lambda"],["w","n"],[["f","if"],[["f","<"],["w","n"],["a",0]],["a",-1],["a",1]]]],[["f","let"],["w","math:radians"],[["f","lambda"],["w","deg"],[["f","*"],["w","deg"],["w","math:PI"],[["f","/"],["a",180]]]]],[["f","let"],["w","math:average"],[["f","safety"],["w","lambda"],["w","x"],["w","y"],[["f","*"],[["f","+"],["w","x"],["w","y"]],["a",0.5]]]],[["f","let"],["w","math:euclidean-mod"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","mod"],[["f","+"],[["f","mod"],["w","a"],["w","b"]],["w","b"]],["w","b"]]]],[["f","let"],["w","math:euclidean-distance"],[["f","lambda"],["w","x1"],["w","y1"],["w","x2"],["w","y2"],[["f","do"],[["f","let"],["w","a"],[["f","-"],["w","x1"],["w","x2"]]],[["f","let"],["w","b"],[["f","-"],["w","y1"],["w","y2"]]],[["f","math:sqrt"],[["f","+"],[["f","*"],["w","a"],["w","a"]],[["f","*"],["w","b"],["w","b"]]]]]]],[["f","let"],["w","math:manhattan-distance"],[["f","lambda"],["w","x1"],["w","y1"],["w","x2"],["w","y2"],[["f","+"],[["f","math:abs"],[["f","-"],["w","x2"],["w","x1"]]],[["f","math:abs"],[["f","-"],["w","y2"],["w","y1"]]]]]],[["f","let"],["w","math:positive?"],[["f","safety"],["w","lambda"],["w","num"],[["f",">"],["w","num"],["a",0]]]],[["f","let"],["w","math:negative?"],[["f","safety"],["w","lambda"],["w","num"],[["f","<"],["w","num"],["a",0]]]],[["f","let"],["w","math:zero?"],[["f","safety"],["w","lambda"],["w","num"],[["f","="],["w","num"],["a",0]]]],[["f","let"],["w","math:divisible?"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","="],[["f","mod"],["w","a"],["w","b"]],["a",0]]]],[["f","let"],["w","math:ascending?"],[["f","lambda"],["w","a"],["w","b"],[["f",">"],["w","a"],["w","b"]]]],[["f","let"],["w","math:descending?"],[["f","lambda"],["w","a"],["w","b"],[["f","<"],["w","a"],["w","b"]]]],[["f","let"],["w","math:prime?"],[["f","lambda"],["w","n"],[["f","cond"],[["f","="],["w","n"],["a",1]],["a",0],[["f","<"],["w","n"],["a",0]],["a",0],[["f","*"]],[["f","do"],[["f","let*"],["w","iter"],[["f","lambda"],["w","i"],["w","end"],[["f","do"],[["f","let"],["w","is-prime"],[["f","not"],[["f","="],[["f","mod"],["w","n"],["w","i"]],["a",0]]]],[["f","if"],[["f","and"],[["f","<="],["w","i"],["w","end"]],["w","is-prime"]],[["f","iter"],[["f","+"],["w","i"],["a",1]],["w","end"]],["w","is-prime"]]]]],[["f","or"],[["f","="],["w","n"],["a",2]],[["f","iter"],["a",2],[["f","math:sqrt"],["w","n"]]]]]]]],[["f","let"],["w","array:slice"],[["f","lambda"],["w","arr"],["w","start"],["w","end"],[["f","do"],[["f","let"],["w","bounds"],[["f","-"],["w","end"],["w","start"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","out"],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","array:get"],["w","arr"],[["f","+"],["w","start"],["w","i"]]]]]],["w","out"]]]],[["f","iterate"],["a",0],[]]]]],[["f","let"],["w","array:binary-search"],[["f","lambda"],["w","arr"],["w","target"],[["f","do"],[["f","let*"],["w","search"],[["f","lambda"],["w","arr"],["w","target"],["w","start"],["w","end"],[["f","do"],[["f","when"],[["f","<="],["w","start"],["w","end"]],[["f","do"],[["f","let"],["w","index"],[["f","math:floor"],[["f","*"],[["f","+"],["w","start"],["w","end"]],["a",0.5]]]],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","index"]]],[["f","if"],[["f","="],["w","target"],["w","current"]],["w","target"],[["f","if"],[["f",">"],["w","current"],["w","target"]],[["f","search"],["w","arr"],["w","target"],["w","start"],[["f","-"],["w","index"],["a",1]]],[["f","search"],["w","arr"],["w","target"],[["f","+"],["w","index"],["a",1]],["w","end"]]]]]]]]],[["f","search"],["w","arr"],["w","target"],["a",0],[["f","length"],["w","arr"]]]]]],[["f","let"],["w","array:zip"],[["f","lambda"],["w","A"],["w","B"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","a"],["w","b"],["w","output"],[["f","if"],[["f","and"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","iterate"],[["f","cdr"],["w","a"]],[["f","cdr"],["w","b"]],[["f","array:merge!"],["w","output"],[["f","array"],[["f","array"],[["f","car"],["w","a"]],[["f","car"],["w","b"]]]]]],["w","output"]]]],[["f","iterate"],["w","A"],["w","B"],[]]]]],[["f","let"],["w","math:cartesian-product"],[["f","lambda"],["w","a"],["w","b"],[["f","array:fold"],["w","a"],[["f","lambda"],["w","p"],["w","x"],[["f","array:merge!"],["w","p"],[["f","array:map"],["w","b"],[["f","lambda"],["w","y"],[["f","array"],["w","x"],["w","y"]]]]]],[]]]],[["f","let"],["w","array:equal?"],[["f","lambda"],["w","a"],["w","b"],[["f","or"],[["f","and"],[["f","number?"],["w","a"]],[["f","number?"],["w","b"]],[["f","="],["w","a"],["w","b"]]],[["f","and"],[["f","string?"],["w","a"]],[["f","string?"],["w","b"]],[["f","string:equal?"],["w","a"],["w","b"]]],[["f","and"],[["f","array?"],["w","a"]],[["f","="],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","not"],[["f","array:some?"],[["f","math:sequence"],["w","a"]],[["f","lambda"],["w","i"],[["f","not"],[["f","array:equal?"],[["f","array:get"],["w","a"],["w","i"]],[["f","array:get"],["w","b"],["w","i"]]]]]]]]]]],[["f","let"],["w","array:join"],[["f","lambda"],["w","arr"],["w","delim"],[["f","array:fold"],[["f","array:zip"],["w","arr"],[["f","math:sequence"],["w","arr"]]],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","car"],[["f","cdr"],["w","b"]]],["a",0]],[["f","string:merge"],["w","a"],["w","delim"],[["f","type"],[["f","car"],["w","b"]],["w","string"]]],[["f","type"],[["f","car"],["w","b"]],["w","string"]]]],["a",""]]]],[["f","let"],["w","array:flat"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let"],["w","flatten"],[["f","lambda"],["w","item"],[["f","if"],[["f","and"],[["f","array?"],["w","item"]],[["f","length"],["w","item"]]],[["f","array:fold"],["w","item"],[["f","lambda"],["w","a"],["w","b"],[["f","array:merge!"],["w","a"],[["f","flatten"],["w","b"]]]],[]],[["f","array"],["w","item"]]]]],[["f","flatten"],["w","arr"]]]]],[["f","let"],["w","array:sort"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","if"],[["f","<="],[["f","length"],["w","arr"]],["a",1]],["w","arr"],[["f","do"],[["f","let"],["w","pivot"],[["f","car"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","bounds"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","i"]]],[["f","let"],["w","predicate"],[["f","callback"],["w","current"],["w","pivot"]]],[["f","let"],["w","left"],[["f","if"],[["f","="],["w","predicate"],["a",0]],[["f","array:merge"],["w","a"],[["f","array"],["w","current"]]],["w","a"]]],[["f","let"],["w","right"],[["f","if"],[["f","="],["w","predicate"],["a",1]],[["f","array:merge"],["w","b"],[["f","array"],["w","current"]]],["w","b"]]],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]],["w","bounds"],["w","left"],["w","right"]],[["f","array"],["w","left"],["w","right"]]]]]],[["f","let"],["w","sorted"],[["f","iterate"],["a",1],[["f","-"],[["f","length"],["w","arr"]],["a",1]],[],[]]],[["f","let"],["w","left"],[["f","car"],["w","sorted"]]],[["f","let"],["w","right"],[["f","car"],[["f","cdr"],["w","sorted"]]]],[["f","array:merge"],[["f","array:sort"],["w","left"],["w","callback"]],[["f","array"],["w","pivot"]],[["f","array:sort"],["w","right"],["w","callback"]]]]]]]],[["f","let"],["w","array:set"],[["f","lambda"],["w","arr"],["w","i"],["w","value"],[["f","if"],[["f","array:in-bounds?"],["w","arr"],["w","i"]],[["f","array:map"],[["f","math:sequence"],["w","arr"]],[["f","lambda"],["w","x"],[["f","if"],[["f","="],["w","x"],["w","i"]],["w","value"],[["f","array:get"],["w","arr"],["w","x"]]]]],[["f","throw"],[["f","string:merge"],[["f","type"],["w","i"],["w","string"]],["a"," is outside of the array bounds"]]]]]],[["f","let"],["w","array:adjacent-difference"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let"],["w","len"],[["f","length"],["w","arr"]]],[["f","unless"],[["f","="],["w","len"],["a",1]],[["f","do"],[["f","array"],[["f","car"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","result"],[["f","if"],[["f","<"],["w","i"],["w","len"]],[["f","do"],[["f","iterate"],[["f","+"],["w","i"],["a",1]],[["f","array:set!"],["w","result"],["w","i"],[["f","callback"],[["f","array:get"],["w","arr"],[["f","-"],["w","i"],["a",1]]],[["f","array:get"],["w","arr"],["w","i"]]]]]],["w","result"]]]],[["f","iterate"],["a",1],["w","arr"]]],["w","arr"]]]]],[["f","let"],["w","array:adjacent-find"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let"],["w","len"],[["f","length"],["w","arr"]]],[["f","otherwise"],[["f","="],["w","len"],["a",1]],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],[["f","if"],[["f","<"],["w","i"],["w","len"]],[["f","if"],[["f","callback"],[["f","let"],["w","prev"],[["f","array:get"],["w","arr"],[["f","-"],["w","i"],["a",1]]]],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","i"]]]],["w","prev"],[["f","iterate"],[["f","+"],["w","i"],["a",1]]]],[]]]],[["f","iterate"],["a",1]]]]]]],[["f","let"],["w","array:adjacent"],[["f","lambda"],["w","arr"],["w","directions"],["w","y"],["w","x"],["w","callback"],[["f","array:for"],["w","directions"],[["f","lambda"],["w","dir"],[["f","do"],[["f","let"],["w","dy"],[["f","+"],[["f","car"],["w","dir"]],["w","y"]]],[["f","let"],["w","dx"],[["f","+"],[["f","car"],[["f","cdr"],["w","dir"]]],["w","x"]]],[["f","when"],[["f","and"],[["f","array:in-bounds?"],["w","arr"],["w","dy"]],[["f","array:in-bounds?"],[["f","array:get"],["w","arr"],["w","dy"]],["w","dx"]]],[["f","callback"],[["f","array:get"],[["f","array:get"],["w","arr"],["w","dy"]],["w","dx"]],["w","dir"]]]]]]]],[["f","let"],["w","array:partition"],[["f","lambda"],["w","arr"],["w","n"],[["f","array:fold"],[["f","array:zip"],["w","arr"],[["f","math:sequence"],["w","arr"]]],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","x"],[["f","car"],["w","b"]]],[["f","let"],["w","i"],[["f","car"],[["f","cdr"],["w","b"]]]],[["f","if"],[["f","mod"],["w","i"],["w","n"]],[["f","array:set!"],[["f","let"],["w","last-a"],[["f","array:get"],["w","a"],["a",-1]]],[["f","length"],["w","last-a"]],["w","x"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[["f","do"],[["f","let"],["w","mut-arr"],[]],[["f","array:set!"],["w","mut-arr"],[["f","length"],["w","mut-arr"]],["w","x"]]]]],["w","a"]]],[]]]],[["f","let"],["w","string:split"],[["f","lambda"],["w","str"],["w","delim"],[["f","do"],[["f","let"],["w","locals"],[]],[["f","let"],["w","delim-arr"],[["f","type"],["w","delim"],["w","array"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],["w","delim-arr"]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],[["f","type"],["w","str"],["w","array"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],[["f","length"],["w","delim-arr"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],["a",""]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","result"],["w","i"],["w","bounds"],[["f","if"],[["f","<"],[["f","if"],[["f","array:every?"],[["f","array:zip"],[["f","array:get"],["w","locals"],["a",0]],[["f","math:sequence"],["w","locals"]]],[["f","lambda"],["w","item"],[["f","do"],[["f","let"],["w","y"],[["f","car"],["w","item"]]],[["f","let"],["w","j"],[["f","car"],[["f","cdr"],["w","item"]]]],[["f","or"],[["f","<="],[["f","length"],[["f","array:get"],["w","locals"],["a",1]]],[["f","+"],["w","i"],["w","j"]]],[["f","="],[["f","type"],[["f","array:get"],[["f","array:get"],["w","locals"],["a",1]],[["f","+"],["w","i"],["w","j"]]],["w","char-code"]],[["f","type"],["w","y"],["w","char-code"]]]]]]],[["f","do"],[["f","array:set!"],["w","result"],[["f","length"],["w","result"]],[["f","array:get"],["w","locals"],["a",3]]],[["f","array:set!"],["w","locals"],["a",3],["a",""]],[["f","+"],["w","i"],[["f","array:get"],["w","locals"],["a",2]],["a",-1]]],[["f","do"],[["f","array:set!"],["w","locals"],["a",3],[["f","string:merge"],[["f","array:get"],["w","locals"],["a",3]],[["f","array:get"],[["f","array:get"],["w","locals"],["a",1]],["w","i"]]]],["w","i"]]],["w","bounds"]],[["f","iterate"],["w","result"],[["f","+"],["w","i"],["a",1]],["w","bounds"]],["w","result"]]]],[["f","array:set!"],[["f","let"],["w","iteration-result"],[["f","iterate"],[],["a",0],[["f","-"],[["f","length"],[["f","array:get"],["w","locals"],["a",1]]],["a",1]]]],[["f","length"],["w","iteration-result"]],[["f","array:get"],["w","locals"],["a",3]]]]]],[["f","let"],["w","array:copy"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],["w","b"]]],[]]]],[["f","let"],["w","array:merge!"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","array:for"],["w","b"],[["f","lambda"],["w","x"],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],["w","x"]]]],["w","a"]]]],[["f","let"],["w","array:swap-remove!"],[["f","lambda"],["w","arr"],["w","i"],[["f","do"],[["f","array:set!"],["w","arr"],["w","i"],[["f","array:get"],["w","arr"],[["f","-"],[["f","length"],["w","arr"]],["a",1]]]],[["f","array:set!"],["w","arr"],["a",-1]]]]],[["f","let"],["w","array:index-of"],[["f","safety"],["w","lambda"],["w","arr"],["w","item"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","="],[["f","car"],["w","arr"]],["w","item"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","arr"],["a",0]]]]],[["f","let"],["w","string:index-of-char"],[["f","lambda"],["w","str"],["w","character"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","string:equal?"],[["f","car"],["w","arr"]],["w","character"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],[["f","type"],["w","str"],["w","array"]],["a",0]]]]],[["f","let"],["w","string:match"],[["f","lambda"],["w","str"],["w","word"],[["f","do"],[["f","let"],["w","string-arr"],[["f","type"],["w","str"],["w","array"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","string:equal?"],[["f","pi"],["w","string-arr"],[["f","array:slice"],["w","i"],[["f","+"],["w","i"],[["f","length"],["w","word"]]]],[["f","array:join"],["a",""]]],["w","word"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","toArr"],["a",0]]]]],[["f","let"],["w","array:find-index"],[["f","safety"],["w","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","arr"],["a",0]]]]],[["f","let"],["w","array:remove"],[["f","lambda"],["w","arr"],["w","i"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","x"],[["f","do"],[["f","unless"],[["f","="],["w","x"],["w","i"]],[["f","array:merge!"],["w","a"],[["f","array"],["w","x"]]],["w","a"]]]],[]]]],[["f","let"],["w","array:pad-right"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge"],["w","b"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]]],[["f","array:merge"],["w","a"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]]]]]],[["f","let"],["w","array:pad-left"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]],["w","b"]],[["f","array:merge"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]],["w","a"]]]]],[["f","let"],["w","array:pad-right!"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge!"],["w","b"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]]],[["f","array:merge!"],["w","a"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]]]]]],[["f","let"],["w","array:pad-left!"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge!"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]],["w","b"]],[["f","array:merge!"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]],["w","a"]]]]],[["f","let"],["w","string:greater?"],[["f","lambda"],["w","L"],["w","R"],[["f","otherwise"],[["f","string:equal?"],["w","L"],["w","R"]],[["f","do"],[["f","let"],["w","A"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","let"],["w","B"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","a"],[["f","if"],[["f","<"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","A"],[["f","array"],[["f","-"],[["f","length"],["w","B"]],[["f","length"],["w","A"]]],["w","length"]]],["w","A"]]],[["f","let"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","B"],[["f","array"],[["f","-"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],["w","length"]]],["w","B"]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:fold"],[["f","lambda"],["w","acc"],["w","pair"],[["f","if"],[["f",">"],[["f","car"],["w","pair"]],[["f","car"],[["f","cdr"],["w","pair"]]]],["a",0],["w","acc"]]],["a",1]]]]]]],[["f","let"],["w","string:lesser?"],[["f","lambda"],["w","L"],["w","R"],[["f","otherwise"],[["f","string:equal?"],["w","L"],["w","R"]],[["f","do"],[["f","let"],["w","A"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","let"],["w","B"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","a"],[["f","if"],[["f","<"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","A"],[["f","array"],[["f","-"],[["f","length"],["w","B"]],[["f","length"],["w","A"]]],["w","length"]]],["w","A"]]],[["f","let"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","B"],[["f","array"],[["f","-"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],["w","length"]]],["w","B"]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:fold"],[["f","lambda"],["w","acc"],["w","pair"],[["f","if"],[["f","<"],[["f","car"],["w","pair"]],[["f","car"],[["f","cdr"],["w","pair"]]]],["a",0],["w","acc"]]],["a",1]]]]]]],[["f","let"],["w","string:equal?"],[["f","lambda"],["w","L"],["w","R"],[["f","when"],[["f","="],[["f","length"],["w","L"]],[["f","length"],["w","R"]]],[["f","do"],[["f","let"],["w","a"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","b"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:every?"],[["f","lambda"],["w","x"],[["f","="],[["f","car"],["w","x"]],[["f","car"],[["f","cdr"],["w","x"]]]]]]]]]]],[["f","let"],["w","new:set"],[["f","lambda"],["w","items"],[["f","set:add!"],[["f","array"],[],[],[],[]],["w","items"]]]],[["f","let"],["w","new:array"],[["f","safety"],["w","lambda"],["w","items"],[["f","type"],["w","items"],["w","array"]]]],[["f","let"],["w","new:list"],[["f","safety"],["w","lambda"],["w","value"],[["f","array"],[],["w","value"],[]]]],[["f","let"],["w","new:binary-tree"],[["f","safety"],["w","lambda"],["w","value"],[["f","do"],[["f","let"],["w","arr"],[]],[["f","array:set!"],["w","arr"],["a",0],["w","value"]],[["f","array:set!"],["w","arr"],["a",1],[]],[["f","array:set!"],["w","arr"],["a",2],[]],["w","arr"]]]],[["f","let"],["w","binary-tree:left"],[["f","safety"],["w","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",1]]]],[["f","let"],["w","binary-tree:right"],[["f","safety"],["w","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",2]]]],[["f","let"],["w","binary-tree:left!"],[["f","safety"],["w","lambda"],["w","tree"],["w","node"],[["f","array:set!"],["w","tree"],["a",1],["w","node"]]]],[["f","let"],["w","binary-tree:right!"],[["f","safety"],["w","lambda"],["w","tree"],["w","node"],[["f","array:set!"],["w","tree"],["a",2],["w","node"]]]],[["f","let"],["w","binary-tree:value"],[["f","safety"],["w","lambda"],["w","node"],[["f","car"],["w","node"]]]],[["f","let"],["w","set:index"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","prime-num"],["a",31]],[["f","let"],["w","key-arr"],[["f","type"],[["f","type"],["w","key"],["w","string"]],["w","array"]]],[["f","let"],["w","total"],[["f","array"],["a",0]]],[["f","let*"],["w","find-hash-index"],[["f","lambda"],["w","i"],["w","bounds"],[["f","do"],[["f","let"],["w","letter"],[["f","array:get"],["w","key-arr"],["w","i"]]],[["f","let"],["w","value"],[["f","-"],[["f","type"],["w","letter"],["w","char-code"]],["a",96]]],[["f","array:set!"],["w","total"],["a",0],[["f","math:euclidean-mod"],[["f","+"],[["f","*"],[["f","car"],["w","total"]],["w","prime-num"]],["w","value"]],[["f","length"],["w","table"]]]],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","find-hash-index"],[["f","+"],["w","i"],["a",1]],["w","bounds"]],[["f","car"],["w","total"]]]]]],[["f","find-hash-index"],["a",0],[["f","if"],[["f","<"],[["f","-"],[["f","length"],["w","key-arr"]],["a",1]],["a",100]],[["f","-"],[["f","length"],["w","key-arr"]],["a",1]],["a",100]]]]]],[["f","let"],["w","set:add!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[["f","array"]]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],["w","key"]],[["f","if"],[["f","="],["w","index"],["a",-1]],[["f","array:set!"],["w","current"],[["f","length"],["w","current"]],["w","entry"]],[["f","array:set!"],["w","current"],["w","index"],["w","entry"]]],["w","table"]]]],[["f","let"],["w","set:remove!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[["f","Array"]]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],["w","key"]],[["f","otherwise"],[["f","="],["w","index"],["a",-1]],[["f","and"],[["f","array:set!"],["w","current"],["w","index"],[["f","array:get"],["w","current"],["a",-1]]],[["f","array:set!"],["w","current"],["a",-1]]]],["w","table"]]]],[["f","let"],["w","set:has?"],[["f","lambda"],["w","table"],["w","key"],[["f","and"],[["f","array:in-bounds?"],["w","table"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]]],[["f","and"],[["f","length"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]]],[["f",">="],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",0]]]]]],[["f","let"],["w","set:intersection"],[["f","lambda"],["w","a"],["w","b"],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:fold"],[["f","lambda"],["w","out"],["w","element"],[["f","do"],[["f","when"],[["f","set:has?"],["w","a"],["w","element"]],[["f","set:add!"],["w","out"],["w","element"]]],["w","out"]]],[["f","array"],[],[],[],[],[]]]]]],[["f","let"],["w","set:difference"],[["f","lambda"],["w","a"],["w","b"],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:fold"],[["f","lambda"],["w","out"],["w","element"],[["f","do"],[["f","when"],[["f","not"],[["f","set:has?"],["w","b"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]],["w","out"]]],[["f","array"],[],[],[],[],[]]]]]],[["f","let"],["w","set:xor"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","out"],[["f","array"],[],[],[],[],[]]],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","when"],[["f","not"],[["f","set:has?"],["w","b"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]]]]],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","when"],[["f","not"],[["f","set:has?"],["w","a"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]]]]],["w","out"]]]],[["f","let"],["w","set:union"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","out"],[["f","array"],[],[],[],[],[]]],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","set:add!"],["w","out"],["w","element"]]]]],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","set:add!"],["w","out"],["w","element"]]]]],["w","out"]]]],[["f","let"],["w","cast:table->array"],[["f","lambda"],["w","set"],[["f","array:select"],[["f","array:flat"],["w","set"]],["w","atom?"]]]],[["f","let"],["w","set:empty!"],[["f","lambda"],["w","table"],[["f","array:map"],["w","table"],["w","empty!"]]]],[["f","let"],["w","map:empty!"],[["f","lambda"],["w","table"],[["f","array:map"],["w","table"],["w","empty!"]]]],[["f","let"],["w","map:set!"],[["f","lambda"],["w","table"],["w","key"],["w","value"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],[["f","car"],["w","x"]],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],[["f","array"],["w","key"],["w","value"]]],[["f","if"],[["f","="],["w","index"],["a",-1]],[["f","array:set!"],["w","current"],[["f","length"],["w","current"]],["w","entry"]],[["f","array:set!"],["w","current"],["w","index"],["w","entry"]]],["w","table"]]]],[["f","let"],["w","map:remove!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],[["f","car"],["w","x"]],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","otherwise"],[["f","="],["w","index"],["a",-1]],[["f","and"],[["f","array:set!"],["w","current"],["w","index"],[["f","array:get"],["w","current"],["a",-1]]],[["f","array:set!"],["w","current"],["a",-1]]]],["w","table"]]]],[["f","let"],["w","map:get"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","when"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","do"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","found"],[["f","array:find"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","key"],["w","string"]],[["f","type"],[["f","array:get"],["w","x"],["a",0]],["w","string"]]]]]],[["f","when"],[["f","length"],["w","found"]],[["f","array:get"],["w","found"],["a",1]]]]]]]],[["f","let"],["w","cast:map->string"],[["f","lambda"],["w","table"],[["f","pi"],["w","table"],[["f","array:select"],["w","length"]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],[["f","array:map"],["w","x"],[["f","lambda"],["w","y"],[["f","array:join"],["w","y"],["a"," -> "]]]],["a"," "]]]],[["f","array:join"],["a","\n"]]]]],[["f","let"],["w","map:has?"],[["f","lambda"],["w","table"],["w","key"],[["f","and"],[["f","array:in-bounds?"],["w","table"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]]],[["f","and"],[["f","length"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]]],[["f",">="],[["f","array:find-index"],[["f","car"],["w","current"]],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",0]]]]]],[["f","let"],["w","list:prev!"],[["f","safety"],["w","lambda"],["w","list"],["w","node"],[["f","array:set!"],["w","list"],["a",0],[["f","array:set!"],["w","node"],["a",2],["w","list"]]]]],[["f","let"],["w","list:next!"],[["f","safety"],["w","lambda"],["w","list"],["w","node"],[["f","array:set!"],["w","list"],["a",2],[["f","array:set!"],["w","node"],["a",0],["w","list"]]]]],[["f","let"],["w","list:prev"],[["f","safety"],["w","lambda"],["w","list"],[["f","array:get"],["w","list"],["a",0]]]],[["f","let"],["w","list:next"],[["f","safety"],["w","lambda"],["w","list"],[["f","array:get"],["w","list"],["a",2]]]],[["f","let"],["w","list:value"],[["f","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",1]]]],[["f","let"],["w","array:rotate-right"],[["f","lambda"],["w","arr"],["w","n"],[["f","pi"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","mod"],[["f","+"],[["f","car"],[["f","cdr"],["w","b"]]],["w","n"]],[["f","length"],["w","arr"]]],[["f","car"],["w","b"]]]],[["f","array"],[["f","length"],["w","arr"]],["w","length"]]]]]],[["f","let"],["w","array:rotate-left"],[["f","lambda"],["w","arr"],["w","n"],[["f","pi"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","mod"],[["f","+"],[["f","car"],[["f","cdr"],["w","b"]]],[["f","-"],[["f","length"],["w","arr"]],["w","n"]]],[["f","length"],["w","arr"]]],[["f","car"],["w","b"]]]],[["f","array"],[["f","length"],["w","arr"]],["w","length"]]]]]],[["f","let"],["w","var:def"],[["f","safety"],["w","lambda"],["w","val"],[["f","array"],["w","val"]]]],[["f","let"],["w","var:get"],[["f","safety"],["w","lambda"],["w","variable"],[["f","car"],["w","variable"]]]],[["f","let"],["w","var:set!"],[["f","safety"],["w","lambda"],["w","variable"],["w","value"],[["f","array:set!"],["w","variable"],["a",0],["w","value"]]]],[["f","let"],["w","var:del!"],[["f","safety"],["w","lambda"],["w","variable"],[["f","array:set!"],["w","variable"],["a",-1]]]],[["f","let"],["w","array:first"],[["f","safety"],["w","lambda"],["w","arr"],[["f","array:get"],["w","arr"],["a",0]]]],[["f","let"],["w","array:last"],[["f","safety"],["w","lambda"],["w","arr"],[["f","array:get"],["w","arr"],["a",-1]]]],[["f","let"],["w","string:trim-left"],[["f","lambda"],["w","str"],[["f","do"],[["f","let"],["w","tr"],[["f","array"],["a",1]]],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","and"],[["f","car"],["w","tr"]],[["f","string:equal?"],["w","b"],["a"," "]]],["w","a"],[["f","do"],[["f","when"],[["f","car"],["w","tr"]],[["f","array:set!"],["w","tr"],["a",0],["a",0]]],[["f","string:merge"],["w","a"],["w","b"]]]]],["a",""]]]]]],[["f","let"],["w","string:trim-right"],[["f","lambda"],["w","str"],[["f","do"],[["f","let"],["w","tr"],[["f","array"],["a",1]]],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:reverse"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","and"],[["f","car"],["w","tr"]],[["f","string:equal?"],["w","b"],["a"," "]]],["w","a"],[["f","do"],[["f","when"],[["f","car"],["w","tr"]],[["f","array:set!"],["w","tr"],["a",0],["a",0]]],[["f","string:merge"],["w","b"],["w","a"]]]]],["a",""]]]]]],[["f","let"],["w","string:trim"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","string:trim-left"]],[["f","string:trim-right"]]]]],[["f","let"],["w","array:enumerate"],[["f","lambda"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]],["w","arr"]]]],[["f","let"],["w","string:lines"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["a","\n"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","string:words"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["a"," "]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","string:seprator"],[["f","lambda"],["w","str"],["w","separator"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["w","separator"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","new:brray"],[["f","lambda"],[["f","array"],[["f","array"],[]],[]]]],[["f","let"],["w","brray:offset-left"],[["f","lambda"],["w","q"],[["f","*"],[["f","-"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],["a",1]],["a",-1]]]],[["f","let"],["w","brray:offset-right"],[["f","lambda"],["w","q"],[["f","length"],[["f","array:get"],["w","q"],["a",1]]]]],[["f","let"],["w","brray:length"],[["f","lambda"],["w","q"],[["f","+"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],[["f","length"],[["f","array:get"],["w","q"],["a",1]]],["a",-1]]]],[["f","let"],["w","brray:empty?"],[["f","lambda"],["w","q"],[["f","not"],[["f","brray:length"],["w","q"]]]]],[["f","let"],["w","brray:empty!"],[["f","lambda"],["w","q"],[["f","do"],[["f","array:set!"],["w","q"],["a",0],[["f","array"],[]]],[["f","array:set!"],["w","q"],["a",1],[]],["w","q"]]]],[["f","let"],["w","brray:get"],[["f","lambda"],["w","q"],["w","offset"],[["f","do"],[["f","let"],["w","offset-index"],[["f","+"],["w","offset"],[["f","brray:offset-left"],["w","q"]]]],[["f","let"],["w","index"],[["f","if"],[["f","<"],["w","offset-index"],["a",0]],[["f","*"],["w","offset-index"],["a",-1]],["w","offset-index"]]],[["f","if"],[["f",">="],["w","offset-index"],["a",0]],[["f","array:get"],[["f","array:get"],["w","q"],["a",1]],["w","index"]],[["f","array:get"],[["f","array:get"],["w","q"],["a",0]],["w","index"]]]]]],[["f","let"],["w","brray:set!"],[["f","lambda"],["w","q"],["w","index"],["w","value"],[["f","do"],[["f","let"],["w","offset"],[["f","+"],["w","offset"],[["f","brray:offset-left"],["w","q"]]]],[["f","if"],[["f",">="],["w","offset"],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",1]],["w","offset"],["w","value"]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",0]],[["f","*"],["w","offset"],["a",-1]],["w","value"]]],["w","q"]]]],[["f","let"],["w","brray:add-to-left!"],[["f","lambda"],["w","q"],["w","item"],[["f","array:set!"],[["f","let"],["w","c"],[["f","array:get"],["w","q"],["a",0]]],[["f","length"],["w","c"]],["w","item"]]]],[["f","let"],["w","brray:add-to-right!"],[["f","lambda"],["w","q"],["w","item"],[["f","array:set!"],[["f","let"],["w","c"],[["f","array:get"],["w","q"],["a",1]]],[["f","length"],["w","c"]],["w","item"]]]],[["f","let"],["w","brray:remove-from-left!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","len"],[["f","brray:length"],["w","q"]]],[["f","when"],["w","len"],[["f","cond"],[["f","="],["w","len"],["a",1]],[["f","brray:empty!"],["w","q"]],[["f",">"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",0]],["a",-1]]]]]]],[["f","let"],["w","brray:remove-from-right!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","len"],[["f","brray:length"],["w","q"]]],[["f","when"],["w","len"],[["f","cond"],[["f","="],["w","len"],["a",1]],[["f","brray:empty!"],["w","q"]],[["f",">"],[["f","length"],[["f","array:get"],["w","q"],["a",1]]],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",1]],["a",-1]]]]]]],[["f","let"],["w","brray:iter"],[["f","lambda"],["w","q"],["w","callback"],[["f","do"],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","callback"],[["f","brray:get"],["w","q"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],[["f","brray:length"],["w","q"]]]]]],[["f","let"],["w","cast:brray->array"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","out"],[]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","array:set!"],["w","out"],[["f","length"],["w","out"]],[["f","brray:get"],["w","q"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],[["f","-"],[["f","brray:length"],["w","q"]],["a",1]]],["w","out"]]]],[["f","let"],["w","brray:balance?"],[["f","lambda"],["w","q"],[["f","="],[["f","+"],[["f","brray:offset-right"],["w","q"]],[["f","brray:offset-left"],["w","q"]]],["a",0]]]],[["f","let"],["w","brray:balance!"],[["f","lambda"],["w","q"],[["f","if"],[["f","brray:balance?"],["w","q"]],["w","q"],[["f","do"],[["f","let"],["w","initial"],[["f","cast:brray->array"],["w","q"]]],[["f","brray:empty!"],["w","q"]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],[["f","length"],["w","initial"]],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],[["f","length"],["w","initial"]],["a",1]]],["w","q"]]]]],[["f","let"],["w","brray:append!"],[["f","lambda"],["w","q"],["w","item"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],["w","item"]],["w","q"]]]],[["f","let"],["w","brray:prepend!"],[["f","lambda"],["w","q"],["w","item"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],["w","item"]],["w","q"]]]],[["f","let"],["w","brray:head!"],[["f","lambda"],["w","q"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-right"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:remove-from-right!"],["w","q"]],["w","q"]]]],[["f","let"],["w","brray:tail!"],[["f","lambda"],["w","q"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-left"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:remove-from-left!"],["w","q"]],["w","q"]]]],[["f","let"],["w","brray:first"],[["f","lambda"],["w","q"],[["f","brray:get"],["w","q"],["a",0]]]],[["f","let"],["w","brray:last"],[["f","lambda"],["w","q"],[["f","brray:get"],["w","q"],[["f","-"],[["f","brray:length"],["w","q"]],["a",1]]]]],[["f","let"],["w","brray:pop-right!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","last"],[["f","brray:last"],["w","q"]]],[["f","brray:head!"],["w","q"]],["w","last"]]]],[["f","let"],["w","brray:pop-left!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","first"],[["f","brray:first"],["w","q"]]],[["f","brray:tail!"],["w","q"]],["w","first"]]]],[["f","let"],["w","brray:rotate-left!"],[["f","lambda"],["w","q"],["w","n"],[["f","do"],[["f","let"],["w","N"],[["f","mod"],["w","n"],[["f","brray:length"],["w","q"]]]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-left"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:add-to-right!"],["w","q"],[["f","brray:first"],["w","q"]]],[["f","brray:remove-from-left!"],["w","q"]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],["w","N"]],["w","q"]]]],[["f","let"],["w","brray:rotate-right!"],[["f","lambda"],["w","q"],["w","n"],[["f","do"],[["f","let"],["w","N"],[["f","mod"],["w","n"],[["f","brray:length"],["w","q"]]]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-right"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:add-to-left!"],["w","q"],[["f","brray:last"],["w","q"]]],[["f","brray:remove-from-right!"],["w","q"]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],["w","N"]],["w","q"]]]],[["f","let"],["w","cast:array->brray"],[["f","lambda"],["w","initial"],[["f","do"],[["f","let"],["w","q"],[["f","new:brray"]]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],[["f","length"],["w","initial"]],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],[["f","length"],["w","initial"]],["a",1]]],["w","q"]]]]]
1
+ export default [[["f","let"],["w","math:E"],["a",2.718281828459045]],[["f","let"],["w","math:PI"],["a",3.141592653589793]],[["f","let*"],["w","array:for"],[["f","lambda"],["w","arr"],["w","callback"],[["f","when"],[["f","length"],["w","arr"]],[["f","do"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","array:for"],[["f","cdr"],["w","arr"]],["w","callback"]]]]]],[["f","let"],["w","array:map"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","callback"],[["f","car"],["w","arr"]]]]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:select"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","car"],["w","arr"]]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:exclude"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","if"],[["f","not"],[["f","callback"],[["f","car"],["w","arr"]]]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","car"],["w","arr"]]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","array:fold"],[["f","lambda"],["w","arr"],["w","callback"],["w","initial"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","callback"],["w","out"],[["f","car"],["w","arr"]]]],["w","out"]]]],[["f","iterate"],["w","arr"],["w","initial"]]]]],[["f","let"],["w","array:every?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","and"],[["f","length"],["w","arr"]],[["f","callback"],[["f","car"],["w","arr"]]]],[["f","iterate"],[["f","cdr"],["w","arr"]]],[["f","not"],[["f","length"],["w","arr"]]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:some?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","and"],[["f","length"],["w","arr"]],[["f","not"],[["f","callback"],[["f","car"],["w","arr"]]]]],[["f","iterate"],[["f","cdr"],["w","arr"]]],[["f","type"],[["f","length"],["w","arr"]],["w","boolean"]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:find"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],[["f","car"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]]]],[]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:has?"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],[["f","when"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],["a",1],[["f","iterate"],[["f","cdr"],["w","arr"]]]]]]],[["f","iterate"],["w","arr"]]]]],[["f","let"],["w","array:reverse"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","out"],[["f","if"],[["f","length"],["w","arr"]],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","array:merge!"],[["f","array"],[["f","car"],["w","arr"]]],["w","out"]]],["w","out"]]]],[["f","iterate"],["w","arr"],[]]]]],[["f","let"],["w","math:range"],[["f","lambda"],["w","start"],["w","end"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<="],["w","count"],["w","end"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["w","start"]]]]],[["f","let"],["w","math:sequence"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let"],["w","end"],[["f","length"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<"],[["f","length"],["w","out"]],["w","end"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["a",0]]]]],[["f","let"],["w","math:sequence-n"],[["f","lambda"],["w","n"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","out"],["w","count"],[["f","if"],[["f","<"],[["f","length"],["w","out"]],["w","n"]],[["f","iterate"],[["f","array:merge!"],["w","out"],[["f","array"],["w","count"]]],[["f","+"],["w","count"],["a",1]]],["w","out"]]]],[["f","iterate"],[],["a",0]]]]],[["f","let"],["w","array:unique"],[["f","lambda"],["w","arr"],[["f","pi"],[["f","let"],["w","sorted"],[["f","array:sort"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">"],["w","a"],["w","b"]]]]],[["f","array:zip"],[["f","math:sequence"],["w","sorted"]]],[["f","array:select"],[["f","lambda"],["w","x"],[["f","or"],[["f","not"],[["f","let"],["w","index"],[["f","car"],[["f","cdr"],["w","x"]]]]],[["f","not"],[["f","="],[["f","array:get"],["w","sorted"],[["f","-"],["w","index"],["a",1]]],[["f","array:get"],["w","sorted"],["w","index"]]]]]]],[["f","array:map"],["w","car"]]]]],[["f","let"],["w","array:for-range"],[["f","lambda"],["w","start"],["w","end"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],[["f","when"],[["f","<"],["w","i"],["w","end"]],[["f","do"],[["f","callback"],["w","i"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]]]]]]],[["f","iterate"],["w","start"]]]]],[["f","let"],["w","array:traverse"],[["f","lambda"],["w","x"],["w","callback"],[["f","if"],[["f","atom?"],["w","x"]],[["f","callback"],["w","x"]],[["f","iterate"],["w","x"],[["f","lambda"],["w","y"],[["f","array:traverse"],["w","y"],["w","callback"]]]]]]],[["f","let"],["w","math:summation"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","+"],["w","a"],["w","b"]]],[["f","+"]]]]],[["f","let"],["w","math:product"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","*"],["w","a"],["w","b"]]],[["f","*"]]]]],[["f","let"],["w","math:maximum"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],["w","a"],["w","b"]],["w","a"],["w","b"]]],[["f","car"],["w","arr"]]]]],[["f","let"],["w","math:minimum"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","if"],[["f","<"],["w","a"],["w","b"]],["w","a"],["w","b"]]],[["f","car"],["w","arr"]]]]],[["f","let"],["w","math:max"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],["w","a"],["w","b"]],["w","a"],["w","b"]]]],[["f","let"],["w","math:min"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","<"],["w","a"],["w","b"]],["w","a"],["w","b"]]]],[["f","let"],["w","array:count-of"],[["f","lambda"],["w","arr"],["w","callback"],[["f","pi"],["w","arr"],[["f","array:select"],["w","callback"]],[["f","length"]]]]],[["f","let"],["w","math:increment"],[["f","safety"],["w","lambda"],["w","i"],[["f","+"],["w","i"],["a",1]]]],[["f","let"],["w","math:floor"],[["f","safety"],["w","lambda"],["w","n"],[["f","|"],["w","n"],["a",0]]]],[["f","let"],["w","math:round"],[["f","safety"],["w","lambda"],["w","n"],[["f","|"],[["f","+"],["w","n"],["a",0.5]],["a",0]]]],[["f","let"],["w","array:empty?"],[["f","safety"],["w","lambda"],["w","arr"],[["f","not"],[["f","length"],["w","arr"]]]]],[["f","let"],["w","array:empty!"],[["f","safety"],["w","lambda"],["w","arr"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],[["f","if"],[["f","length"],["w","arr"]],[["f","do"],[["f","array:set!"],["w","arr"],["a",-1]],[["f","iterate"]]],["w","arr"]]]],[["f","iterate"]]]]],[["f","let"],["w","array:in-bounds?"],[["f","safety"],["w","lambda"],["w","arr"],["w","index"],[["f","and"],[["f","<"],["w","index"],[["f","length"],["w","arr"]]],[["f",">="],["w","index"],["a",0]]]]],[["f","let"],["w","math:largest-power"],[["f","safety"],["w","lambda"],["w","N"],[["f","do"],[["f","let"],["w","N1"],[["f","|"],["w","N"],[["f",">>"],["w","N"],["a",1]]]],[["f","let"],["w","N2"],[["f","|"],["w","N1"],[["f",">>"],["w","N1"],["a",2]]]],[["f","let"],["w","N3"],[["f","|"],["w","N2"],[["f",">>"],["w","N2"],["a",4]]]],[["f","let"],["w","N4"],[["f","|"],["w","N3"],[["f",">>"],["w","N3"],["a",8]]]],[["f",">>"],[["f","+"],["w","N4"],["a",1]],["a",1]]]]],[["f","let"],["w","math:set-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","bit"],[["f","|"],["w","n"],[["f","<<"],["a",1],["w","bit"]]]]],[["f","let"],["w","math:clear-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","bit"],[["f","&"],["w","n"],[["f","~"],[["f","<<"],["a",1],["w","bit"]]]]]],[["f","let"],["w","math:odd-bit?"],[["f","safety"],["w","lambda"],["w","n"],[["f","="],[["f","&"],["w","n"],["a",1]],["a",1]]]],[["f","let"],["w","math:average-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">>"],[["f","+"],["w","a"],["w","b"]],["a",1]]]],[["f","let"],["w","math:toggle-bit"],[["f","safety"],["w","lambda"],["w","n"],["w","a"],["w","b"],[["f","^"],["w","a"],["w","b"],["w","n"]]]],[["f","let"],["w","math:same-sign-bit?"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f",">="],[["f","^"],["w","a"],["w","b"]],["a",0]]]],[["f","let"],["w","math:max-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","-"],["w","a"],[["f","&"],[["f","-"],["w","a"],["w","b"]],[["f",">>"],[["f","-"],["w","a"],["w","b"]],["a",31]]]]]],[["f","let"],["w","math:min-bit"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","-"],["w","a"],[["f","&"],[["f","-"],["w","a"],["w","b"]],[["f",">>"],[["f","-"],["w","b"],["w","a"]],["a",31]]]]]],[["f","let"],["w","math:modulo-bit"],[["f","safety"],["w","lambda"],["w","numerator"],["w","divisor"],[["f","&"],["w","numerator"],[["f","-"],["w","divisor"],["a",1]]]]],[["f","let"],["w","math:n-one-bit?"],[["f","safety"],["w","lambda"],["w","N"],["w","nth"],[["f","type"],[["f","&"],["w","N"],[["f","<<"],["a",1],["w","nth"]]],["w","boolean"]]]],[["f","let"],["w","cast:string->chars"],[["f","safety"],["w","lambda"],["w","str"],[["f","type"],["w","str"],["w","array"]]]],[["f","let"],["w","cast:chars->string"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","safety"],["w","lambda"],["w","a"],["w","x"],[["f","string:merge"],["w","a"],[["f","type"],["w","x"],["w","string"]]]],["a",""]]]],[["f","let"],["w","cast:string->number"],[["f","safety"],["w","lambda"],["w","str"],[["f","type"],["w","str"],["w","number"]]]],[["f","let"],["w","cast:number->string"],[["f","safety"],["w","lambda"],["w","n"],[["f","type"],["w","n"],["w","string"]]]],[["f","let"],["w","cast:strings->numbers"],[["f","lambda"],["w","arr"],[["f","array:map"],["w","arr"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","number"]]]]]],[["f","let"],["w","cast:numbers->strings"],[["f","lambda"],["w","arr"],[["f","array:map"],["w","arr"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","string"]]]]]],[["f","let"],["w","cast:string->char-codes"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char-code"]]]]]]],[["f","let"],["w","cast:chars->char-codes"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char-code"]]]]]]],[["f","let"],["w","cast:chars->numbers"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","number"]]]]]]],[["f","let"],["w","cast:char->number"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","number"]]]],[["f","let"],["w","cast:char->char-code"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","char-code"]]]],[["f","let"],["w","cast:char-code->char"],[["f","safety"],["w","lambda"],["w","ch"],[["f","type"],["w","ch"],["w","char"]]]],[["f","let"],["w","cast:char-codes->chars"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char"]]]]]]],[["f","let"],["w","cast:char-codes->string"],[["f","lambda"],["w","arr"],[["f","pi"],["w","arr"],[["f","array:map"],[["f","safety"],["w","lambda"],["w","x"],[["f","type"],["w","x"],["w","char"]]]],[["f","cast:chars->string"]]]]],[["f","let"],["w","math:square"],[["f","safety"],["w","lambda"],["w","x"],[["f","*"],["w","x"],["w","x"]]]],[["f","let"],["w","math:power"],[["f","lambda"],["w","base"],["w","exp"],[["f","if"],[["f","<"],["w","exp"],["a",0]],[["f","if"],[["f","="],["w","base"],["a",0]],[["f","throw"],["a","Attempting to divide by 0 in (math:power)"]],[["f","/"],[["f","*"],["w","base"],[["f","math:power"],["w","base"],[["f","-"],[["f","*"],["w","exp"],["a",-1]],["a",1]]]]]],[["f","cond"],[["f","="],["w","exp"],["a",0]],["a",1],[["f","="],["w","exp"],["a",1]],["w","base"],[["f","*"]],[["f","*"],["w","base"],[["f","math:power"],["w","base"],[["f","-"],["w","exp"],["a",1]]]]]]]],[["f","let"],["w","math:greatest-common-divisor"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let*"],["w","gcd"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","="],["w","b"],["a",0]],["w","a"],[["f","gcd"],["w","b"],[["f","mod"],["w","a"],["w","b"]]]]]],[["f","gcd"],["w","a"],["w","b"]]]]],[["f","let"],["w","math:least-common-divisor"],[["f","lambda"],["w","a"],["w","b"],[["f","*"],["w","a"],["w","b"],[["f","/"],[["f","math:greatest-common-divisor"],["w","a"],["w","b"]]]]]],[["f","let"],["w","math:sqrt"],[["f","lambda"],["w","x"],[["f","do"],[["f","let"],["w","is-good-enough"],[["f","lambda"],["w","g"],["w","x"],[["f","<"],[["f","math:abs"],[["f","-"],[["f","math:square"],["w","g"]],["w","x"]]],["a",0.01]]]],[["f","let"],["w","improve-guess"],[["f","lambda"],["w","g"],["w","x"],[["f","math:average"],["w","g"],[["f","*"],["w","x"],[["f","/"],["w","g"]]]]]],[["f","let*"],["w","math:sqrt-iter"],[["f","lambda"],["w","g"],["w","x"],[["f","if"],[["f","is-good-enough"],["w","g"],["w","x"]],["w","g"],[["f","math:sqrt-iter"],[["f","improve-guess"],["w","g"],["w","x"]],["w","x"]]]]],[["f","math:sqrt-iter"],["a",1],["w","x"]]]]],[["f","let"],["w","math:circumference"],[["f","lambda"],["w","radius"],[["f","*"],["w","math:PI"],[["f","*"],["w","radius"],["a",2]]]]],[["f","let"],["w","math:hypotenuse"],[["f","lambda"],["w","a"],["w","b"],[["f","math:sqrt"],[["f","+"],[["f","*"],["w","a"],["w","a"]],[["f","*"],["w","b"],["w","b"]]]]]],[["f","let"],["w","math:abs"],[["f","safety"],["w","lambda"],["w","n"],[["f","-"],[["f","^"],["w","n"],[["f",">>"],["w","n"],["a",31]]],[["f",">>"],["w","n"],["a",31]]]]],[["f","let"],["w","math:nth-digit"],[["f","lambda"],["w","digit"],["w","n"],[["f","|"],[["f","mod"],[["f","/"],["w","digit"],[["f","math:power"],["a",10],[["f","-"],["w","n"],["a",1]]]],["a",10]],["a",0.5]]]],[["f","let"],["w","math:normalize"],[["f","safety"],["w","lambda"],["w","value"],["w","math:min"],["w","math:max"],[["f","*"],[["f","-"],["w","value"],["w","math:min"]],[["f","/"],[["f","-"],["w","math:max"],["w","math:min"]]]]]],[["f","let"],["w","math:linear-interpolation"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],["w","n"],[["f","+"],[["f","*"],[["f","-"],["a",1],["w","n"]],["w","a"]],[["f","*"],["w","n"],["w","b"]]]]],[["f","let"],["w","math:gauss-sum"],[["f","safety"],["w","lambda"],["w","n"],[["f","*"],["w","n"],[["f","+"],["w","n"],["a",1]],["a",0.5]]]],[["f","let"],["w","math:gauss-sum-sequance"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","*"],[["f","+"],["w","a"],["w","b"]],[["f","+"],[["f","-"],["w","b"],["w","a"]],["a",1]],["a",0.5]]]],[["f","let"],["w","math:clamp"],[["f","safety"],["w","lambda"],["w","x"],["w","limit"],[["f","if"],[["f",">"],["w","x"],["w","limit"]],["w","limit"],["w","x"]]]],[["f","let"],["w","math:odd?"],[["f","safety"],["w","lambda"],["w","x"],[["f","="],[["f","mod"],["w","x"],["a",2]],["a",1]]]],[["f","let"],["w","math:even?"],[["f","safety"],["w","lambda"],["w","x"],[["f","="],[["f","mod"],["w","x"],["a",2]],["a",0]]]],[["f","let"],["w","math:sign"],[["f","safety"],["w","lambda"],["w","n"],[["f","if"],[["f","<"],["w","n"],["a",0]],["a",-1],["a",1]]]],[["f","let"],["w","math:radians"],[["f","lambda"],["w","deg"],[["f","*"],["w","deg"],["w","math:PI"],[["f","/"],["a",180]]]]],[["f","let"],["w","math:average"],[["f","safety"],["w","lambda"],["w","x"],["w","y"],[["f","*"],[["f","+"],["w","x"],["w","y"]],["a",0.5]]]],[["f","let"],["w","math:euclidean-mod"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","mod"],[["f","+"],[["f","mod"],["w","a"],["w","b"]],["w","b"]],["w","b"]]]],[["f","let"],["w","math:euclidean-distance"],[["f","lambda"],["w","x1"],["w","y1"],["w","x2"],["w","y2"],[["f","do"],[["f","let"],["w","a"],[["f","-"],["w","x1"],["w","x2"]]],[["f","let"],["w","b"],[["f","-"],["w","y1"],["w","y2"]]],[["f","math:sqrt"],[["f","+"],[["f","*"],["w","a"],["w","a"]],[["f","*"],["w","b"],["w","b"]]]]]]],[["f","let"],["w","math:manhattan-distance"],[["f","lambda"],["w","x1"],["w","y1"],["w","x2"],["w","y2"],[["f","+"],[["f","math:abs"],[["f","-"],["w","x2"],["w","x1"]]],[["f","math:abs"],[["f","-"],["w","y2"],["w","y1"]]]]]],[["f","let"],["w","math:positive?"],[["f","safety"],["w","lambda"],["w","num"],[["f",">"],["w","num"],["a",0]]]],[["f","let"],["w","math:negative?"],[["f","safety"],["w","lambda"],["w","num"],[["f","<"],["w","num"],["a",0]]]],[["f","let"],["w","math:zero?"],[["f","safety"],["w","lambda"],["w","num"],[["f","="],["w","num"],["a",0]]]],[["f","let"],["w","math:divisible?"],[["f","safety"],["w","lambda"],["w","a"],["w","b"],[["f","="],[["f","mod"],["w","a"],["w","b"]],["a",0]]]],[["f","let"],["w","math:ascending?"],[["f","lambda"],["w","a"],["w","b"],[["f",">"],["w","a"],["w","b"]]]],[["f","let"],["w","math:descending?"],[["f","lambda"],["w","a"],["w","b"],[["f","<"],["w","a"],["w","b"]]]],[["f","let"],["w","math:prime?"],[["f","lambda"],["w","n"],[["f","cond"],[["f","="],["w","n"],["a",1]],["a",0],[["f","<"],["w","n"],["a",0]],["a",0],[["f","*"]],[["f","do"],[["f","let*"],["w","iter"],[["f","lambda"],["w","i"],["w","end"],[["f","do"],[["f","let"],["w","is-prime"],[["f","not"],[["f","="],[["f","mod"],["w","n"],["w","i"]],["a",0]]]],[["f","if"],[["f","and"],[["f","<="],["w","i"],["w","end"]],["w","is-prime"]],[["f","iter"],[["f","+"],["w","i"],["a",1]],["w","end"]],["w","is-prime"]]]]],[["f","or"],[["f","="],["w","n"],["a",2]],[["f","iter"],["a",2],[["f","math:sqrt"],["w","n"]]]]]]]],[["f","let"],["w","array:slice"],[["f","lambda"],["w","arr"],["w","start"],["w","end"],[["f","do"],[["f","let"],["w","bounds"],[["f","-"],["w","end"],["w","start"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","out"],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]],[["f","array:merge!"],["w","out"],[["f","array"],[["f","array:get"],["w","arr"],[["f","+"],["w","start"],["w","i"]]]]]],["w","out"]]]],[["f","iterate"],["a",0],[]]]]],[["f","let"],["w","array:binary-search"],[["f","lambda"],["w","arr"],["w","target"],[["f","do"],[["f","let*"],["w","search"],[["f","lambda"],["w","arr"],["w","target"],["w","start"],["w","end"],[["f","do"],[["f","when"],[["f","<="],["w","start"],["w","end"]],[["f","do"],[["f","let"],["w","index"],[["f","math:floor"],[["f","*"],[["f","+"],["w","start"],["w","end"]],["a",0.5]]]],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","index"]]],[["f","if"],[["f","="],["w","target"],["w","current"]],["w","target"],[["f","if"],[["f",">"],["w","current"],["w","target"]],[["f","search"],["w","arr"],["w","target"],["w","start"],[["f","-"],["w","index"],["a",1]]],[["f","search"],["w","arr"],["w","target"],[["f","+"],["w","index"],["a",1]],["w","end"]]]]]]]]],[["f","search"],["w","arr"],["w","target"],["a",0],[["f","length"],["w","arr"]]]]]],[["f","let"],["w","array:zip"],[["f","lambda"],["w","A"],["w","B"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","a"],["w","b"],["w","output"],[["f","if"],[["f","and"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","iterate"],[["f","cdr"],["w","a"]],[["f","cdr"],["w","b"]],[["f","array:merge!"],["w","output"],[["f","array"],[["f","array"],[["f","car"],["w","a"]],[["f","car"],["w","b"]]]]]],["w","output"]]]],[["f","iterate"],["w","A"],["w","B"],[]]]]],[["f","let"],["w","math:cartesian-product"],[["f","lambda"],["w","a"],["w","b"],[["f","array:fold"],["w","a"],[["f","lambda"],["w","p"],["w","x"],[["f","array:merge!"],["w","p"],[["f","array:map"],["w","b"],[["f","lambda"],["w","y"],[["f","array"],["w","x"],["w","y"]]]]]],[]]]],[["f","let"],["w","array:equal?"],[["f","lambda"],["w","a"],["w","b"],[["f","or"],[["f","and"],[["f","number?"],["w","a"]],[["f","number?"],["w","b"]],[["f","="],["w","a"],["w","b"]]],[["f","and"],[["f","string?"],["w","a"]],[["f","string?"],["w","b"]],[["f","string:equal?"],["w","a"],["w","b"]]],[["f","and"],[["f","array?"],["w","a"]],[["f","="],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","not"],[["f","array:some?"],[["f","math:sequence"],["w","a"]],[["f","lambda"],["w","i"],[["f","not"],[["f","array:equal?"],[["f","array:get"],["w","a"],["w","i"]],[["f","array:get"],["w","b"],["w","i"]]]]]]]]]]],[["f","let"],["w","array:join"],[["f","lambda"],["w","arr"],["w","delim"],[["f","array:fold"],[["f","array:zip"],["w","arr"],[["f","math:sequence"],["w","arr"]]],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","car"],[["f","cdr"],["w","b"]]],["a",0]],[["f","string:merge"],["w","a"],["w","delim"],[["f","type"],[["f","car"],["w","b"]],["w","string"]]],[["f","type"],[["f","car"],["w","b"]],["w","string"]]]],["a",""]]]],[["f","let"],["w","array:flat-one"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","b"],[["f","array:merge!"],["w","a"],["w","b"]]],[]]]],[["f","let"],["w","array:flat"],[["f","lambda"],["w","arr"],[["f","do"],[["f","let"],["w","flatten"],[["f","lambda"],["w","item"],[["f","if"],[["f","and"],[["f","array?"],["w","item"]],[["f","length"],["w","item"]]],[["f","array:fold"],["w","item"],[["f","lambda"],["w","a"],["w","b"],[["f","array:merge!"],["w","a"],[["f","flatten"],["w","b"]]]],[]],[["f","array"],["w","item"]]]]],[["f","flatten"],["w","arr"]]]]],[["f","let"],["w","array:sort"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","if"],[["f","<="],[["f","length"],["w","arr"]],["a",1]],["w","arr"],[["f","do"],[["f","let"],["w","pivot"],[["f","car"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","bounds"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","i"]]],[["f","let"],["w","predicate"],[["f","callback"],["w","current"],["w","pivot"]]],[["f","let"],["w","left"],[["f","if"],[["f","="],["w","predicate"],["a",0]],[["f","array:merge"],["w","a"],[["f","array"],["w","current"]]],["w","a"]]],[["f","let"],["w","right"],[["f","if"],[["f","="],["w","predicate"],["a",1]],[["f","array:merge"],["w","b"],[["f","array"],["w","current"]]],["w","b"]]],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","iterate"],[["f","+"],["w","i"],["a",1]],["w","bounds"],["w","left"],["w","right"]],[["f","array"],["w","left"],["w","right"]]]]]],[["f","let"],["w","sorted"],[["f","iterate"],["a",1],[["f","-"],[["f","length"],["w","arr"]],["a",1]],[],[]]],[["f","let"],["w","left"],[["f","car"],["w","sorted"]]],[["f","let"],["w","right"],[["f","car"],[["f","cdr"],["w","sorted"]]]],[["f","array:merge"],[["f","array:sort"],["w","left"],["w","callback"]],[["f","array"],["w","pivot"]],[["f","array:sort"],["w","right"],["w","callback"]]]]]]]],[["f","let"],["w","array:set"],[["f","lambda"],["w","arr"],["w","index"],["w","item"],[["f","array:set!"],[["f","type"],["w","arr"],["w","array"]],["w","index"],["w","item"]]]],[["f","let"],["w","array:adjacent-difference"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let"],["w","len"],[["f","length"],["w","arr"]]],[["f","unless"],[["f","="],["w","len"],["a",1]],[["f","do"],[["f","array"],[["f","car"],["w","arr"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],["w","result"],[["f","if"],[["f","<"],["w","i"],["w","len"]],[["f","do"],[["f","iterate"],[["f","+"],["w","i"],["a",1]],[["f","array:set!"],["w","result"],["w","i"],[["f","callback"],[["f","array:get"],["w","arr"],[["f","-"],["w","i"],["a",1]]],[["f","array:get"],["w","arr"],["w","i"]]]]]],["w","result"]]]],[["f","iterate"],["a",1],["w","arr"]]],["w","arr"]]]]],[["f","let"],["w","array:adjacent-find"],[["f","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let"],["w","len"],[["f","length"],["w","arr"]]],[["f","otherwise"],[["f","="],["w","len"],["a",1]],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","i"],[["f","if"],[["f","<"],["w","i"],["w","len"]],[["f","if"],[["f","callback"],[["f","let"],["w","prev"],[["f","array:get"],["w","arr"],[["f","-"],["w","i"],["a",1]]]],[["f","let"],["w","current"],[["f","array:get"],["w","arr"],["w","i"]]]],["w","prev"],[["f","iterate"],[["f","+"],["w","i"],["a",1]]]],[]]]],[["f","iterate"],["a",1]]]]]]],[["f","let"],["w","array:adjacent"],[["f","lambda"],["w","arr"],["w","directions"],["w","y"],["w","x"],["w","callback"],[["f","array:for"],["w","directions"],[["f","lambda"],["w","dir"],[["f","do"],[["f","let"],["w","dy"],[["f","+"],[["f","car"],["w","dir"]],["w","y"]]],[["f","let"],["w","dx"],[["f","+"],[["f","car"],[["f","cdr"],["w","dir"]]],["w","x"]]],[["f","when"],[["f","and"],[["f","array:in-bounds?"],["w","arr"],["w","dy"]],[["f","array:in-bounds?"],[["f","array:get"],["w","arr"],["w","dy"]],["w","dx"]]],[["f","callback"],[["f","array:get"],[["f","array:get"],["w","arr"],["w","dy"]],["w","dx"]],["w","dir"]]]]]]]],[["f","let"],["w","array:partition"],[["f","lambda"],["w","arr"],["w","n"],[["f","array:fold"],[["f","array:zip"],["w","arr"],[["f","math:sequence"],["w","arr"]]],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","x"],[["f","car"],["w","b"]]],[["f","let"],["w","i"],[["f","car"],[["f","cdr"],["w","b"]]]],[["f","if"],[["f","mod"],["w","i"],["w","n"]],[["f","array:set!"],[["f","let"],["w","last-a"],[["f","array:get"],["w","a"],["a",-1]]],[["f","length"],["w","last-a"]],["w","x"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[["f","do"],[["f","let"],["w","mut-arr"],[]],[["f","array:set!"],["w","mut-arr"],[["f","length"],["w","mut-arr"]],["w","x"]]]]],["w","a"]]],[]]]],[["f","let"],["w","string:split"],[["f","lambda"],["w","str"],["w","delim"],[["f","do"],[["f","let"],["w","locals"],[]],[["f","let"],["w","delim-arr"],[["f","type"],["w","delim"],["w","array"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],["w","delim-arr"]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],[["f","type"],["w","str"],["w","array"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],[["f","length"],["w","delim-arr"]]],[["f","array:set!"],["w","locals"],[["f","length"],["w","locals"]],["a",""]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","result"],["w","i"],["w","bounds"],[["f","if"],[["f","<"],[["f","if"],[["f","array:every?"],[["f","array:zip"],[["f","array:get"],["w","locals"],["a",0]],[["f","math:sequence"],["w","locals"]]],[["f","lambda"],["w","item"],[["f","do"],[["f","let"],["w","y"],[["f","car"],["w","item"]]],[["f","let"],["w","j"],[["f","car"],[["f","cdr"],["w","item"]]]],[["f","or"],[["f","<="],[["f","length"],[["f","array:get"],["w","locals"],["a",1]]],[["f","+"],["w","i"],["w","j"]]],[["f","="],[["f","type"],[["f","array:get"],[["f","array:get"],["w","locals"],["a",1]],[["f","+"],["w","i"],["w","j"]]],["w","char-code"]],[["f","type"],["w","y"],["w","char-code"]]]]]]],[["f","do"],[["f","array:set!"],["w","result"],[["f","length"],["w","result"]],[["f","array:get"],["w","locals"],["a",3]]],[["f","array:set!"],["w","locals"],["a",3],["a",""]],[["f","+"],["w","i"],[["f","array:get"],["w","locals"],["a",2]],["a",-1]]],[["f","do"],[["f","array:set!"],["w","locals"],["a",3],[["f","string:merge"],[["f","array:get"],["w","locals"],["a",3]],[["f","array:get"],[["f","array:get"],["w","locals"],["a",1]],["w","i"]]]],["w","i"]]],["w","bounds"]],[["f","iterate"],["w","result"],[["f","+"],["w","i"],["a",1]],["w","bounds"]],["w","result"]]]],[["f","array:set!"],[["f","let"],["w","iteration-result"],[["f","iterate"],[],["a",0],[["f","-"],[["f","length"],[["f","array:get"],["w","locals"],["a",1]]],["a",1]]]],[["f","length"],["w","iteration-result"]],[["f","array:get"],["w","locals"],["a",3]]]]]],[["f","let"],["w","array:shallow-copy"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],["w","b"]]],[]]]],[["f","let"],["w","array:deep-copy"],[["f","lambda"],["w","arr"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[["f","if"],[["f","array?"],["w","b"]],[["f","array:deep-copy"],["w","b"]],["w","b"]]]],[]]]],[["f","let"],["w","array:merge!"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","array:for"],["w","b"],[["f","lambda"],["w","x"],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],["w","x"]]]],["w","a"]]]],[["f","let"],["w","array:swap-remove!"],[["f","lambda"],["w","arr"],["w","i"],[["f","do"],[["f","array:set!"],["w","arr"],["w","i"],[["f","array:get"],["w","arr"],[["f","-"],[["f","length"],["w","arr"]],["a",1]]]],[["f","array:set!"],["w","arr"],["a",-1]]]]],[["f","let"],["w","array:index-of"],[["f","safety"],["w","lambda"],["w","arr"],["w","item"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","="],[["f","car"],["w","arr"]],["w","item"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","arr"],["a",0]]]]],[["f","let"],["w","string:index-of-char"],[["f","lambda"],["w","str"],["w","character"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","string:equal?"],[["f","car"],["w","arr"]],["w","character"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],[["f","type"],["w","str"],["w","array"]],["a",0]]]]],[["f","let"],["w","string:match"],[["f","lambda"],["w","str"],["w","word"],[["f","do"],[["f","let"],["w","string-arr"],[["f","type"],["w","str"],["w","array"]]],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","string:equal?"],[["f","pi"],["w","string-arr"],[["f","array:slice"],["w","i"],[["f","+"],["w","i"],[["f","length"],["w","word"]]]],[["f","array:join"],["a",""]]],["w","word"]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","toArr"],["a",0]]]]],[["f","let"],["w","array:find-index"],[["f","safety"],["w","lambda"],["w","arr"],["w","callback"],[["f","do"],[["f","let*"],["w","iterate"],[["f","lambda"],["w","arr"],["w","i"],[["f","if"],[["f","length"],["w","arr"]],[["f","if"],[["f","callback"],[["f","car"],["w","arr"]]],["w","i"],[["f","iterate"],[["f","cdr"],["w","arr"]],[["f","+"],["w","i"],["a",1]]]],["a",-1]]]],[["f","iterate"],["w","arr"],["a",0]]]]],[["f","let"],["w","array:remove"],[["f","lambda"],["w","arr"],["w","i"],[["f","array:fold"],["w","arr"],[["f","lambda"],["w","a"],["w","x"],[["f","do"],[["f","unless"],[["f","="],["w","x"],["w","i"]],[["f","array:merge!"],["w","a"],[["f","array"],["w","x"]]],["w","a"]]]],[]]]],[["f","let"],["w","array:pad-right"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge"],["w","b"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]]],[["f","array:merge"],["w","a"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]]]]]],[["f","let"],["w","array:pad-left"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]],["w","b"]],[["f","array:merge"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]],["w","a"]]]]],[["f","let"],["w","array:pad-right!"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge!"],["w","b"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]]],[["f","array:merge!"],["w","a"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]]]]]],[["f","let"],["w","array:pad-left!"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],[["f","array:merge!"],[["f","array"],[["f","-"],[["f","length"],["w","a"]],[["f","length"],["w","b"]]],["w","length"]],["w","b"]],[["f","array:merge!"],[["f","array"],[["f","-"],[["f","length"],["w","b"]],[["f","length"],["w","a"]]],["w","length"]],["w","a"]]]]],[["f","let"],["w","string:greater?"],[["f","lambda"],["w","L"],["w","R"],[["f","otherwise"],[["f","string:equal?"],["w","L"],["w","R"]],[["f","do"],[["f","let"],["w","A"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","let"],["w","B"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","a"],[["f","if"],[["f","<"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","A"],[["f","array"],[["f","-"],[["f","length"],["w","B"]],[["f","length"],["w","A"]]],["w","length"]]],["w","A"]]],[["f","let"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","B"],[["f","array"],[["f","-"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],["w","length"]]],["w","B"]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:fold"],[["f","lambda"],["w","acc"],["w","pair"],[["f","if"],[["f",">"],[["f","car"],["w","pair"]],[["f","car"],[["f","cdr"],["w","pair"]]]],["a",0],["w","acc"]]],["a",1]]]]]]],[["f","let"],["w","string:lesser?"],[["f","lambda"],["w","L"],["w","R"],[["f","otherwise"],[["f","string:equal?"],["w","L"],["w","R"]],[["f","do"],[["f","let"],["w","A"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","let"],["w","B"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","a"],[["f","if"],[["f","<"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","A"],[["f","array"],[["f","-"],[["f","length"],["w","B"]],[["f","length"],["w","A"]]],["w","length"]]],["w","A"]]],[["f","let"],["w","b"],[["f","if"],[["f",">"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],[["f","array:merge!"],["w","B"],[["f","array"],[["f","-"],[["f","length"],["w","A"]],[["f","length"],["w","B"]]],["w","length"]]],["w","B"]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:fold"],[["f","lambda"],["w","acc"],["w","pair"],[["f","if"],[["f","<"],[["f","car"],["w","pair"]],[["f","car"],[["f","cdr"],["w","pair"]]]],["a",0],["w","acc"]]],["a",1]]]]]]],[["f","let"],["w","string:equal?"],[["f","lambda"],["w","L"],["w","R"],[["f","when"],[["f","="],[["f","length"],["w","L"]],[["f","length"],["w","R"]]],[["f","do"],[["f","let"],["w","a"],[["f","cast:string->char-codes"],[["f","type"],["w","R"],["w","string"]]]],[["f","let"],["w","b"],[["f","cast:string->char-codes"],[["f","type"],["w","L"],["w","string"]]]],[["f","pi"],["w","a"],[["f","array:zip"],["w","b"]],[["f","array:every?"],[["f","lambda"],["w","x"],[["f","="],[["f","car"],["w","x"]],[["f","car"],[["f","cdr"],["w","x"]]]]]]]]]]],[["f","let"],["w","new:set"],[["f","lambda"],["w","items"],[["f","set:add!"],[["f","array"],[],[],[],[]],["w","items"]]]],[["f","let"],["w","new:array"],[["f","safety"],["w","lambda"],["w","items"],[["f","type"],["w","items"],["w","array"]]]],[["f","let"],["w","new:list"],[["f","safety"],["w","lambda"],["w","value"],[["f","array"],[],["w","value"],[]]]],[["f","let"],["w","new:binary-tree"],[["f","safety"],["w","lambda"],["w","value"],[["f","do"],[["f","let"],["w","arr"],[]],[["f","array:set!"],["w","arr"],["a",0],["w","value"]],[["f","array:set!"],["w","arr"],["a",1],[]],[["f","array:set!"],["w","arr"],["a",2],[]],["w","arr"]]]],[["f","let"],["w","binary-tree:left"],[["f","safety"],["w","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",1]]]],[["f","let"],["w","binary-tree:right"],[["f","safety"],["w","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",2]]]],[["f","let"],["w","binary-tree:left!"],[["f","safety"],["w","lambda"],["w","tree"],["w","node"],[["f","array:set!"],["w","tree"],["a",1],["w","node"]]]],[["f","let"],["w","binary-tree:right!"],[["f","safety"],["w","lambda"],["w","tree"],["w","node"],[["f","array:set!"],["w","tree"],["a",2],["w","node"]]]],[["f","let"],["w","binary-tree:value"],[["f","safety"],["w","lambda"],["w","node"],[["f","car"],["w","node"]]]],[["f","let"],["w","set:index"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","prime-num"],["a",31]],[["f","let"],["w","key-arr"],[["f","type"],[["f","type"],["w","key"],["w","string"]],["w","array"]]],[["f","let"],["w","total"],[["f","array"],["a",0]]],[["f","let*"],["w","find-hash-index"],[["f","lambda"],["w","i"],["w","bounds"],[["f","do"],[["f","let"],["w","letter"],[["f","array:get"],["w","key-arr"],["w","i"]]],[["f","let"],["w","value"],[["f","-"],[["f","type"],["w","letter"],["w","char-code"]],["a",96]]],[["f","array:set!"],["w","total"],["a",0],[["f","math:euclidean-mod"],[["f","+"],[["f","*"],[["f","car"],["w","total"]],["w","prime-num"]],["w","value"]],[["f","length"],["w","table"]]]],[["f","if"],[["f","<"],["w","i"],["w","bounds"]],[["f","find-hash-index"],[["f","+"],["w","i"],["a",1]],["w","bounds"]],[["f","car"],["w","total"]]]]]],[["f","find-hash-index"],["a",0],[["f","if"],[["f","<"],[["f","-"],[["f","length"],["w","key-arr"]],["a",1]],["a",100]],[["f","-"],[["f","length"],["w","key-arr"]],["a",1]],["a",100]]]]]],[["f","let"],["w","set:add!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[["f","array"]]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],["w","key"]],[["f","if"],[["f","="],["w","index"],["a",-1]],[["f","array:set!"],["w","current"],[["f","length"],["w","current"]],["w","entry"]],[["f","array:set!"],["w","current"],["w","index"],["w","entry"]]],["w","table"]]]],[["f","let"],["w","set:remove!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[["f","Array"]]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],["w","key"]],[["f","otherwise"],[["f","="],["w","index"],["a",-1]],[["f","and"],[["f","array:set!"],["w","current"],["w","index"],[["f","array:get"],["w","current"],["a",-1]]],[["f","array:set!"],["w","current"],["a",-1]]]],["w","table"]]]],[["f","let"],["w","set:has?"],[["f","lambda"],["w","table"],["w","key"],[["f","and"],[["f","array:in-bounds?"],["w","table"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]]],[["f","and"],[["f","length"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]]],[["f",">="],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",0]]]]]],[["f","let"],["w","set:intersection"],[["f","lambda"],["w","a"],["w","b"],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:fold"],[["f","lambda"],["w","out"],["w","element"],[["f","do"],[["f","when"],[["f","set:has?"],["w","a"],["w","element"]],[["f","set:add!"],["w","out"],["w","element"]]],["w","out"]]],[["f","array"],[],[],[],[],[]]]]]],[["f","let"],["w","set:difference"],[["f","lambda"],["w","a"],["w","b"],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:fold"],[["f","lambda"],["w","out"],["w","element"],[["f","do"],[["f","when"],[["f","not"],[["f","set:has?"],["w","b"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]],["w","out"]]],[["f","array"],[],[],[],[],[]]]]]],[["f","let"],["w","set:xor"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","out"],[["f","array"],[],[],[],[],[]]],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","when"],[["f","not"],[["f","set:has?"],["w","b"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]]]]],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","when"],[["f","not"],[["f","set:has?"],["w","a"],["w","element"]]],[["f","set:add!"],["w","out"],["w","element"]]]]]],["w","out"]]]],[["f","let"],["w","set:union"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","out"],[["f","array"],[],[],[],[],[]]],[["f","pi"],["w","a"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","set:add!"],["w","out"],["w","element"]]]]],[["f","pi"],["w","b"],[["f","cast:table->array"]],[["f","array:for"],[["f","lambda"],["w","element"],[["f","set:add!"],["w","out"],["w","element"]]]]],["w","out"]]]],[["f","let"],["w","cast:table->array"],[["f","lambda"],["w","set"],[["f","array:select"],[["f","array:flat"],["w","set"]],["w","atom?"]]]],[["f","let"],["w","set:empty!"],[["f","lambda"],["w","table"],[["f","array:map"],["w","table"],["w","empty!"]]]],[["f","let"],["w","map:empty!"],[["f","lambda"],["w","table"],[["f","array:map"],["w","table"],["w","empty!"]]]],[["f","let"],["w","map:set!"],[["f","lambda"],["w","table"],["w","key"],["w","value"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],[["f","car"],["w","x"]],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","let"],["w","entry"],[["f","array"],["w","key"],["w","value"]]],[["f","if"],[["f","="],["w","index"],["a",-1]],[["f","array:set!"],["w","current"],[["f","length"],["w","current"]],["w","entry"]],[["f","array:set!"],["w","current"],["w","index"],["w","entry"]]],["w","table"]]]],[["f","let"],["w","map:remove!"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","otherwise"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","array:set!"],["w","table"],["w","idx"],[]]],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","len"],[["f","length"],["w","current"]]],[["f","let"],["w","index"],[["f","if"],["w","len"],[["f","array:find-index"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],[["f","car"],["w","x"]],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",-1]]],[["f","otherwise"],[["f","="],["w","index"],["a",-1]],[["f","and"],[["f","array:set!"],["w","current"],["w","index"],[["f","array:get"],["w","current"],["a",-1]]],[["f","array:set!"],["w","current"],["a",-1]]]],["w","table"]]]],[["f","let"],["w","map:get"],[["f","lambda"],["w","table"],["w","key"],[["f","do"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]],[["f","when"],[["f","array:in-bounds?"],["w","table"],["w","idx"]],[["f","do"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]],[["f","let"],["w","found"],[["f","array:find"],["w","current"],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","key"],["w","string"]],[["f","type"],[["f","array:get"],["w","x"],["a",0]],["w","string"]]]]]],[["f","when"],[["f","length"],["w","found"]],[["f","array:get"],["w","found"],["a",1]]]]]]]],[["f","let"],["w","cast:map->string"],[["f","lambda"],["w","table"],[["f","pi"],["w","table"],[["f","array:select"],["w","length"]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],[["f","array:map"],["w","x"],[["f","lambda"],["w","y"],[["f","array:join"],["w","y"],["a"," -> "]]]],["a"," "]]]],[["f","array:join"],["a","\n"]]]]],[["f","let"],["w","map:has?"],[["f","lambda"],["w","table"],["w","key"],[["f","and"],[["f","array:in-bounds?"],["w","table"],[["f","let"],["w","idx"],[["f","set:index"],["w","table"],["w","key"]]]],[["f","and"],[["f","length"],[["f","let"],["w","current"],[["f","array:get"],["w","table"],["w","idx"]]]],[["f",">="],[["f","array:find-index"],[["f","car"],["w","current"]],[["f","lambda"],["w","x"],[["f","string:equal?"],[["f","type"],["w","x"],["w","string"]],[["f","type"],["w","key"],["w","string"]]]]],["a",0]]]]]],[["f","let"],["w","list:prev!"],[["f","safety"],["w","lambda"],["w","list"],["w","node"],[["f","array:set!"],["w","list"],["a",0],[["f","array:set!"],["w","node"],["a",2],["w","list"]]]]],[["f","let"],["w","list:next!"],[["f","safety"],["w","lambda"],["w","list"],["w","node"],[["f","array:set!"],["w","list"],["a",2],[["f","array:set!"],["w","node"],["a",0],["w","list"]]]]],[["f","let"],["w","list:prev"],[["f","safety"],["w","lambda"],["w","list"],[["f","array:get"],["w","list"],["a",0]]]],[["f","let"],["w","list:next"],[["f","safety"],["w","lambda"],["w","list"],[["f","array:get"],["w","list"],["a",2]]]],[["f","let"],["w","list:value"],[["f","lambda"],["w","node"],[["f","array:get"],["w","node"],["a",1]]]],[["f","let"],["w","array:rotate-right"],[["f","lambda"],["w","arr"],["w","n"],[["f","pi"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","mod"],[["f","+"],[["f","car"],[["f","cdr"],["w","b"]]],["w","n"]],[["f","length"],["w","arr"]]],[["f","car"],["w","b"]]]],[["f","array"],[["f","length"],["w","arr"]],["w","length"]]]]]],[["f","let"],["w","array:rotate-left"],[["f","lambda"],["w","arr"],["w","n"],[["f","pi"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","array:set!"],["w","a"],[["f","mod"],[["f","+"],[["f","car"],[["f","cdr"],["w","b"]]],[["f","-"],[["f","length"],["w","arr"]],["w","n"]]],[["f","length"],["w","arr"]]],[["f","car"],["w","b"]]]],[["f","array"],[["f","length"],["w","arr"]],["w","length"]]]]]],[["f","let"],["w","var:def"],[["f","safety"],["w","lambda"],["w","val"],[["f","array"],["w","val"]]]],[["f","let"],["w","var:get"],[["f","safety"],["w","lambda"],["w","variable"],[["f","car"],["w","variable"]]]],[["f","let"],["w","var:set!"],[["f","safety"],["w","lambda"],["w","variable"],["w","value"],[["f","array:set!"],["w","variable"],["a",0],["w","value"]]]],[["f","let"],["w","var:del!"],[["f","safety"],["w","lambda"],["w","variable"],[["f","array:set!"],["w","variable"],["a",-1]]]],[["f","let"],["w","array:first"],[["f","safety"],["w","lambda"],["w","arr"],[["f","array:get"],["w","arr"],["a",0]]]],[["f","let"],["w","array:last"],[["f","safety"],["w","lambda"],["w","arr"],[["f","array:get"],["w","arr"],["a",-1]]]],[["f","let"],["w","string:trim-left"],[["f","lambda"],["w","str"],[["f","do"],[["f","let"],["w","tr"],[["f","array"],["a",1]]],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","and"],[["f","car"],["w","tr"]],[["f","string:equal?"],["w","b"],["a"," "]]],["w","a"],[["f","do"],[["f","when"],[["f","car"],["w","tr"]],[["f","array:set!"],["w","tr"],["a",0],["a",0]]],[["f","string:merge"],["w","a"],["w","b"]]]]],["a",""]]]]]],[["f","let"],["w","string:trim-right"],[["f","lambda"],["w","str"],[["f","do"],[["f","let"],["w","tr"],[["f","array"],["a",1]]],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:reverse"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","if"],[["f","and"],[["f","car"],["w","tr"]],[["f","string:equal?"],["w","b"],["a"," "]]],["w","a"],[["f","do"],[["f","when"],[["f","car"],["w","tr"]],[["f","array:set!"],["w","tr"],["a",0],["a",0]]],[["f","string:merge"],["w","b"],["w","a"]]]]],["a",""]]]]]],[["f","let"],["w","string:trim"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","string:trim-left"]],[["f","string:trim-right"]]]]],[["f","let"],["w","array:enumerate"],[["f","lambda"],["w","arr"],[["f","array:zip"],[["f","math:sequence"],["w","arr"]],["w","arr"]]]],[["f","let"],["w","string:lines"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["a","\n"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","string:words"],[["f","lambda"],["w","str"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["a"," "]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","string:seprator"],[["f","lambda"],["w","str"],["w","separator"],[["f","pi"],["w","str"],[["f","type"],["w","array"]],[["f","array:fold"],[["f","lambda"],["w","a"],["w","b"],[["f","do"],[["f","let"],["w","prev"],[["f","array:get"],["w","a"],["a",-1]]],[["f","if"],[["f","string:equal?"],["w","b"],["w","separator"]],[["f","array:set!"],["w","a"],[["f","length"],["w","a"]],[]],[["f","array:set!"],["w","prev"],[["f","length"],["w","prev"]],["w","b"]]],["w","a"]]],[["f","array"],[]]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","array:join"],["w","x"],["a",""]]]]]]],[["f","let"],["w","new:brray"],[["f","lambda"],[["f","array"],[["f","array"],[]],[]]]],[["f","let"],["w","brray:offset-left"],[["f","lambda"],["w","q"],[["f","*"],[["f","-"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],["a",1]],["a",-1]]]],[["f","let"],["w","brray:offset-right"],[["f","lambda"],["w","q"],[["f","length"],[["f","array:get"],["w","q"],["a",1]]]]],[["f","let"],["w","brray:length"],[["f","lambda"],["w","q"],[["f","+"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],[["f","length"],[["f","array:get"],["w","q"],["a",1]]],["a",-1]]]],[["f","let"],["w","brray:empty?"],[["f","lambda"],["w","q"],[["f","not"],[["f","brray:length"],["w","q"]]]]],[["f","let"],["w","brray:empty!"],[["f","lambda"],["w","q"],[["f","do"],[["f","array:set!"],["w","q"],["a",0],[["f","array"],[]]],[["f","array:set!"],["w","q"],["a",1],[]],["w","q"]]]],[["f","let"],["w","brray:get"],[["f","lambda"],["w","q"],["w","offset"],[["f","do"],[["f","let"],["w","offset-index"],[["f","+"],["w","offset"],[["f","brray:offset-left"],["w","q"]]]],[["f","let"],["w","index"],[["f","if"],[["f","<"],["w","offset-index"],["a",0]],[["f","*"],["w","offset-index"],["a",-1]],["w","offset-index"]]],[["f","if"],[["f",">="],["w","offset-index"],["a",0]],[["f","array:get"],[["f","array:get"],["w","q"],["a",1]],["w","index"]],[["f","array:get"],[["f","array:get"],["w","q"],["a",0]],["w","index"]]]]]],[["f","let"],["w","brray:set!"],[["f","lambda"],["w","q"],["w","index"],["w","value"],[["f","do"],[["f","let"],["w","offset"],[["f","+"],["w","offset"],[["f","brray:offset-left"],["w","q"]]]],[["f","if"],[["f",">="],["w","offset"],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",1]],["w","offset"],["w","value"]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",0]],[["f","*"],["w","offset"],["a",-1]],["w","value"]]],["w","q"]]]],[["f","let"],["w","brray:add-to-left!"],[["f","lambda"],["w","q"],["w","item"],[["f","array:set!"],[["f","let"],["w","c"],[["f","array:get"],["w","q"],["a",0]]],[["f","length"],["w","c"]],["w","item"]]]],[["f","let"],["w","brray:add-to-right!"],[["f","lambda"],["w","q"],["w","item"],[["f","array:set!"],[["f","let"],["w","c"],[["f","array:get"],["w","q"],["a",1]]],[["f","length"],["w","c"]],["w","item"]]]],[["f","let"],["w","brray:remove-from-left!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","len"],[["f","brray:length"],["w","q"]]],[["f","when"],["w","len"],[["f","cond"],[["f","="],["w","len"],["a",1]],[["f","brray:empty!"],["w","q"]],[["f",">"],[["f","length"],[["f","array:get"],["w","q"],["a",0]]],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",0]],["a",-1]]]]]]],[["f","let"],["w","brray:remove-from-right!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","len"],[["f","brray:length"],["w","q"]]],[["f","when"],["w","len"],[["f","cond"],[["f","="],["w","len"],["a",1]],[["f","brray:empty!"],["w","q"]],[["f",">"],[["f","length"],[["f","array:get"],["w","q"],["a",1]]],["a",0]],[["f","array:set!"],[["f","array:get"],["w","q"],["a",1]],["a",-1]]]]]]],[["f","let"],["w","brray:iter"],[["f","lambda"],["w","q"],["w","callback"],[["f","do"],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","callback"],[["f","brray:get"],["w","q"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],[["f","brray:length"],["w","q"]]]]]],[["f","let"],["w","brray:map"],[["f","lambda"],["w","q"],["w","callback"],[["f","do"],[["f","let"],["w","result"],[["f","new:brray"]]],[["f","let"],["w","len"],[["f","brray:length"],["w","q"]]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],["w","len"],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","result"],[["f","callback"],[["f","brray:get"],["w","q"],["w","index"]]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","result"],[["f","callback"],[["f","brray:get"],["w","q"],["w","index"]]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],["w","len"],["a",1]]],["w","result"]]]],[["f","let"],["w","cast:brray->array"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","out"],[]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","array:set!"],["w","out"],[["f","length"],["w","out"]],[["f","brray:get"],["w","q"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],[["f","-"],[["f","brray:length"],["w","q"]],["a",1]]],["w","out"]]]],[["f","let"],["w","brray:balance?"],[["f","lambda"],["w","q"],[["f","="],[["f","+"],[["f","brray:offset-right"],["w","q"]],[["f","brray:offset-left"],["w","q"]]],["a",0]]]],[["f","let"],["w","brray:balance!"],[["f","lambda"],["w","q"],[["f","if"],[["f","brray:balance?"],["w","q"]],["w","q"],[["f","do"],[["f","let"],["w","initial"],[["f","cast:brray->array"],["w","q"]]],[["f","brray:empty!"],["w","q"]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],[["f","length"],["w","initial"]],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],[["f","length"],["w","initial"]],["a",1]]],["w","q"]]]]],[["f","let"],["w","brray:append!"],[["f","lambda"],["w","q"],["w","item"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],["w","item"]],["w","q"]]]],[["f","let"],["w","brray:prepend!"],[["f","lambda"],["w","q"],["w","item"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],["w","item"]],["w","q"]]]],[["f","let"],["w","brray:head!"],[["f","lambda"],["w","q"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-right"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:remove-from-right!"],["w","q"]],["w","q"]]]],[["f","let"],["w","brray:tail!"],[["f","lambda"],["w","q"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-left"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:remove-from-left!"],["w","q"]],["w","q"]]]],[["f","let"],["w","brray:first"],[["f","lambda"],["w","q"],[["f","brray:get"],["w","q"],["a",0]]]],[["f","let"],["w","brray:last"],[["f","lambda"],["w","q"],[["f","brray:get"],["w","q"],[["f","-"],[["f","brray:length"],["w","q"]],["a",1]]]]],[["f","let"],["w","brray:pop-right!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","last"],[["f","brray:last"],["w","q"]]],[["f","brray:head!"],["w","q"]],["w","last"]]]],[["f","let"],["w","brray:pop-left!"],[["f","lambda"],["w","q"],[["f","do"],[["f","let"],["w","first"],[["f","brray:first"],["w","q"]]],[["f","brray:tail!"],["w","q"]],["w","first"]]]],[["f","let"],["w","brray:rotate-left!"],[["f","lambda"],["w","q"],["w","n"],[["f","do"],[["f","let"],["w","N"],[["f","mod"],["w","n"],[["f","brray:length"],["w","q"]]]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-left"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:add-to-right!"],["w","q"],[["f","brray:first"],["w","q"]]],[["f","brray:remove-from-left!"],["w","q"]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],["w","N"]],["w","q"]]]],[["f","let"],["w","brray:rotate-right!"],[["f","lambda"],["w","q"],["w","n"],[["f","do"],[["f","let"],["w","N"],[["f","mod"],["w","n"],[["f","brray:length"],["w","q"]]]],[["f","let*"],["w","iter"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","when"],[["f","="],[["f","brray:offset-right"],["w","q"]],["a",0]],[["f","brray:balance!"],["w","q"]]],[["f","brray:add-to-left!"],["w","q"],[["f","brray:last"],["w","q"]]],[["f","brray:remove-from-right!"],["w","q"]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","iter"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","iter"],["a",0],["w","N"]],["w","q"]]]],[["f","let"],["w","cast:array->brray"],[["f","lambda"],["w","initial"],[["f","do"],[["f","let"],["w","q"],[["f","new:brray"]]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],[["f","length"],["w","initial"]],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","q"],[["f","array:get"],["w","initial"],["w","index"]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],[["f","length"],["w","initial"]],["a",1]]],["w","q"]]]],[["f","let"],["w","brray:slice"],[["f","lambda"],["w","entity"],["w","s"],["w","e"],[["f","do"],[["f","let"],["w","len"],[["f","brray:length"],["w","entity"]]],[["f","let"],["w","start"],[["f","if"],[["f","<"],["w","s"],["a",0]],[["f","math:max"],[["f","+"],["w","len"],["w","s"]],["a",0]],[["f","math:min"],["w","s"],["w","len"]]]],[["f","let"],["w","end"],[["f","if"],[["f","<"],["w","e"],["a",0]],[["f","math:max"],[["f","+"],["w","len"],["w","e"]],["a",0]],[["f","math:min"],["w","e"],["w","len"]]]],[["f","let"],["w","slice"],[["f","new:brray"]]],[["f","let"],["w","slice-len"],[["f","math:max"],[["f","-"],["w","end"],["w","start"]],["a",0]]],[["f","let"],["w","half"],[["f","math:floor"],[["f","*"],["w","slice-len"],["a",0.5]]]],[["f","let*"],["w","left"],[["f","lambda"],["w","index"],[["f","do"],[["f","brray:add-to-left!"],["w","slice"],[["f","brray:get"],["w","entity"],[["f","+"],["w","start"],["w","index"]]]],[["f","when"],[["f",">"],["w","index"],["a",0]],[["f","left"],[["f","-"],["w","index"],["a",1]]]]]]],[["f","left"],[["f","-"],["w","half"],["a",1]]],[["f","let*"],["w","rigth"],[["f","lambda"],["w","index"],["w","bounds"],[["f","do"],[["f","brray:add-to-right!"],["w","slice"],[["f","brray:get"],["w","entity"],[["f","+"],["w","start"],["w","index"]]]],[["f","when"],[["f","<"],["w","index"],["w","bounds"]],[["f","rigth"],[["f","+"],["w","index"],["a",1]],["w","bounds"]]]]]],[["f","rigth"],["w","half"],[["f","-"],["w","slice-len"],["a",1]]],["w","slice"]]]],[["f","let"],["w","date:add-seconds"],[["f","lambda"],["w","date-time"],["w","seconds"],[["f","+"],["w","date-time"],[["f","*"],["w","seconds"],["a",1000]]]]],[["f","let"],["w","date:add-minutes"],[["f","lambda"],["w","date-time"],["w","minutes"],[["f","+"],["w","date-time"],[["f","*"],["w","minutes"],["a",1000],["a",60]]]]],[["f","let"],["w","date:add-hours"],[["f","lambda"],["w","date-time"],["w","hours"],[["f","+"],["w","date-time"],[["f","*"],["w","hours"],["a",1000],["a",60],["a",60]]]]],[["f","let"],["w","date:add-days"],[["f","lambda"],["w","date-time"],["w","days"],[["f","+"],["w","date-time"],[["f","*"],["w","days"],["a",1000],["a",60],["a",60],["a",24]]]]],[["f","let"],["w","date:add-months"],[["f","lambda"],["w","date-time"],["w","months"],[["f","+"],["w","date-time"],[["f","*"],["w","months"],["a",1000],["a",60],["a",60],["a",24],["a",30]]]]],[["f","let"],["w","date:add-years"],[["f","lambda"],["w","date-time"],["w","years"],[["f","+"],["w","date-time"],[["f","*"],["w","years"],["a",1000],["a",60],["a",60],["a",24],["a",365]]]]],[["f","let"],["w","date:sub-seconds"],[["f","lambda"],["w","date-time"],["w","seconds"],[["f","-"],["w","date-time"],[["f","*"],["w","seconds"],["a",1000]]]]],[["f","let"],["w","date:sub-minutes"],[["f","lambda"],["w","date-time"],["w","minutes"],[["f","-"],["w","date-time"],[["f","*"],["w","minutes"],["a",1000],["a",60]]]]],[["f","let"],["w","date:sub-hours"],[["f","lambda"],["w","date-time"],["w","hours"],[["f","-"],["w","date-time"],[["f","*"],["w","hours"],["a",1000],["a",60],["a",60]]]]],[["f","let"],["w","date:sub-days"],[["f","lambda"],["w","date-time"],["w","days"],[["f","-"],["w","date-time"],[["f","*"],["w","days"],["a",1000],["a",60],["a",60],["a",24]]]]],[["f","let"],["w","date:sub-months"],[["f","lambda"],["w","date-time"],["w","months"],[["f","-"],["w","date-time"],[["f","*"],["w","months"],["a",1000],["a",60],["a",60],["a",24],["a",30]]]]],[["f","let"],["w","date:sub-years"],[["f","lambda"],["w","date-time"],["w","years"],[["f","-"],["w","date-time"],[["f","*"],["w","years"],["a",1000],["a",60],["a",60],["a",24],["a",365]]]]],[["f","let"],["w","math:permutations"],[["f","lambda"],["w","xs"],[["f","unless"],[["f","length"],["w","xs"]],[["f","array"],[]],[["f","pi"],["w","xs"],[["f","array:flat-one"]],[["f","array:map"],[["f","lambda"],["w","x"],[["f","pi"],["w","xs"],[["f","array:exclude"],[["f","lambda"],["w","y"],[["f","="],["w","x"],["w","y"]]]],[["f","math:permutations"]],[["f","array:map"],[["f","lambda"],["w","vs"],[["f","array:fold"],["w","vs"],[["f","lambda"],["w","a"],["w","b"],[["f","array:merge!"],["w","a"],["w","b"]]],[["f","array"],["w","x"]]]]]]]]]]]]]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.0.23",
5
+ "version": "1.0.26",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/compiler.js CHANGED
@@ -29,14 +29,6 @@ return result
29
29
  isAtom: `atomPredicate=(value)=>typeof value==='number'||typeof value==='string'`,
30
30
  error: `_error=(error)=>{
31
31
  throw new Error(error)
32
- }`,
33
- arraySet: `arraySet=(array,index,value)=>{
34
- array=[...array]
35
- if (index < 0) {
36
- const target = array.length + index
37
- while (array.length !== target) array.pop()
38
- } else array[index] = value;
39
- return array
40
32
  }`,
41
33
  arraySetEffect: `arraySetEffect=(array,index,value)=>{
42
34
  if (index < 0) {
@@ -323,8 +315,6 @@ const compile = (tree, Variables) => {
323
315
  }
324
316
  case KEYWORDS.SERIALISE:
325
317
  return `serialise(${compile(Arguments[0], Variables)});`
326
- case KEYWORDS.SET_IMMUTABLE_ARRAY:
327
- return `arraySet(${parseArgs(Arguments, Variables)});`
328
318
  case KEYWORDS.SET_ARRAY:
329
319
  return `arraySetEffect(${parseArgs(Arguments, Variables)});`
330
320
  case KEYWORDS.NOT_COMPILED_BLOCK:
package/src/enums.js CHANGED
@@ -77,5 +77,4 @@ export const KEYWORDS = {
77
77
  SERIALISE: 'serialise',
78
78
 
79
79
  SET_ARRAY: 'array:set!',
80
- SET_IMMUTABLE_ARRAY: 'array:set',
81
80
  }
package/src/tokeniser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TYPE, VALUE, WORD, KEYWORDS, APPLY } from './enums.js'
2
2
  import { evaluate } from './interpreter.js'
3
- import { isLeaf, stringify } from './parser.js'
3
+ import { stringify } from './parser.js'
4
4
  import {
5
5
  isAtom,
6
6
  isEqual,
@@ -14,9 +14,9 @@ const keywords = {
14
14
  if (args.length < 2)
15
15
  throw new RangeError(
16
16
  `Invalid number of arguments for (${
17
- keywords.CONCATENATION
17
+ KEYWORDS.CONCATENATION
18
18
  }), expected > 1 but got ${args.length}. (${
19
- keywords.CONCATENATION
19
+ KEYWORDS.CONCATENATION
20
20
  } ${stringifyArgs(args)})`
21
21
  )
22
22
  const operands = args.map((x) => evaluate(x, env))
@@ -89,7 +89,7 @@ const keywords = {
89
89
  throw new RangeError(
90
90
  `Invalid number of arguments for (${
91
91
  KEYWORDS.ARRAY_OR_STRING_LENGTH
92
- }) (1 required) (${KEYWORDS.ARRAY_OR_STRING_LENGTH} ${stringifyArgs(
92
+ }) (= 1 required) (${KEYWORDS.ARRAY_OR_STRING_LENGTH} ${stringifyArgs(
93
93
  args
94
94
  )})`
95
95
  )
@@ -107,9 +107,9 @@ const keywords = {
107
107
  [KEYWORDS.IS_ARRAY]: (args, env) => {
108
108
  if (args.length !== 1)
109
109
  throw new RangeError(
110
- `Invalid number of arguments for (${KEYWORDS.IS_ARRAY}) (1 required) (${
110
+ `Invalid number of arguments for (${
111
111
  KEYWORDS.IS_ARRAY
112
- } ${stringifyArgs(args)})`
112
+ }) (= 1 required) (${KEYWORDS.IS_ARRAY} ${stringifyArgs(args)})`
113
113
  )
114
114
  const array = evaluate(args[0], env)
115
115
  return +Array.isArray(array)
@@ -119,7 +119,7 @@ const keywords = {
119
119
  throw new RangeError(
120
120
  `Invalid number of arguments for (${
121
121
  KEYWORDS.IS_NUMBER
122
- }) (1 required) (${KEYWORDS.IS_NUMBER} ${stringifyArgs(args)})`
122
+ }) (= 1 required) (${KEYWORDS.IS_NUMBER} ${stringifyArgs(args)})`
123
123
  )
124
124
  return +(typeof evaluate(args[0], env) === 'number')
125
125
  },
@@ -128,7 +128,7 @@ const keywords = {
128
128
  throw new RangeError(
129
129
  `Invalid number of arguments for (${
130
130
  KEYWORDS.IS_STRING
131
- }) (1 required) (${KEYWORDS.IS_STRING} ${stringifyArgs(args)})`
131
+ }) (= 1 required) (${KEYWORDS.IS_STRING} ${stringifyArgs(args)})`
132
132
  )
133
133
  return +(typeof evaluate(args[0], env) === 'string')
134
134
  },
@@ -137,7 +137,7 @@ const keywords = {
137
137
  throw new RangeError(
138
138
  `Invalid number of arguments for (${
139
139
  KEYWORDS.IS_FUNCTION
140
- }) (1 required) (${KEYWORDS.IS_FUNCTION} ${stringifyArgs(args)})`
140
+ }) (= 1 required) (${KEYWORDS.IS_FUNCTION} ${stringifyArgs(args)})`
141
141
  )
142
142
  return +(typeof evaluate(args[0], env) === 'function')
143
143
  },
@@ -280,9 +280,9 @@ const keywords = {
280
280
  [KEYWORDS.IS_ATOM]: (args, env) => {
281
281
  if (args.length !== 1)
282
282
  throw new RangeError(
283
- `Invalid number of arguments for (${KEYWORDS.IS_ATOM}) (1 required) (${
283
+ `Invalid number of arguments for (${
284
284
  KEYWORDS.IS_ATOM
285
- } ${stringifyArgs(args)})`
285
+ }) (= 1 required) (${KEYWORDS.IS_ATOM} ${stringifyArgs(args)})`
286
286
  )
287
287
  return isAtom(args[0], env)
288
288
  },
@@ -291,7 +291,7 @@ const keywords = {
291
291
  throw new RangeError(
292
292
  `Invalid number of arguments for (${
293
293
  KEYWORDS.FIRST_ARRAY
294
- }) (1 required) (${KEYWORDS.FIRST_ARRAY} ${stringifyArgs(args)})`
294
+ }) (= 1 required) (${KEYWORDS.FIRST_ARRAY} ${stringifyArgs(args)})`
295
295
  )
296
296
  const array = evaluate(args[0], env)
297
297
  if (!Array.isArray(array))
@@ -320,7 +320,7 @@ const keywords = {
320
320
  throw new RangeError(
321
321
  `Invalid number of arguments for (${
322
322
  KEYWORDS.REST_ARRAY
323
- }) (1 required) (${KEYWORDS.REST_ARRAY} ${stringifyArgs(args)})`
323
+ }) (= 1 required) (${KEYWORDS.REST_ARRAY} ${stringifyArgs(args)})`
324
324
  )
325
325
  const array = evaluate(args[0], env)
326
326
  if (!Array.isArray(array))
@@ -342,7 +342,7 @@ const keywords = {
342
342
  throw new RangeError(
343
343
  `Invalid number of arguments for (${
344
344
  KEYWORDS.GET_ARRAY
345
- }) (2 required) (${KEYWORDS.GET_ARRAY} ${stringifyArgs(args)})`
345
+ }) (= 2 required) (${KEYWORDS.GET_ARRAY} ${stringifyArgs(args)})`
346
346
  )
347
347
  const array = evaluate(args[0], env)
348
348
  if (!Array.isArray(array))
@@ -379,27 +379,6 @@ const keywords = {
379
379
  )
380
380
  return value
381
381
  },
382
- [KEYWORDS.LOG]: (args, env) => {
383
- if (!args.length)
384
- throw new RangeError(
385
- `Invalid number of arguments to (${KEYWORDS.LOG}) (>= 1 required) (${
386
- KEYWORDS.LOG
387
- } ${stringifyArgs(args)})`
388
- )
389
- const expressions = args.map((x) => evaluate(x, env))
390
- console.log(...expressions)
391
- return expressions.at(-1)
392
- },
393
- [KEYWORDS.CLEAR_CONSOLE]: (args) => {
394
- if (args.length)
395
- throw new RangeError(
396
- `Invalid number of arguments to (${
397
- KEYWORDS.CLEAR_CONSOLE
398
- }) (0 required) (${KEYWORDS.CLEAR_CONSOLE} ${stringifyArgs(args)})`
399
- )
400
- console.clear()
401
- return 0
402
- },
403
382
  [KEYWORDS.BLOCK]: (args, env) => {
404
383
  if (!args.length)
405
384
  throw new RangeError(
@@ -436,7 +415,7 @@ const keywords = {
436
415
  [KEYWORDS.NOT]: (args, env) => {
437
416
  if (args.length !== 1)
438
417
  throw new RangeError(
439
- `Invalid number of arguments for (${KEYWORDS.NOT}) (1 required) (${
418
+ `Invalid number of arguments for (${KEYWORDS.NOT}) (= 1 required) (${
440
419
  KEYWORDS.NOT
441
420
  } ${stringifyArgs(args)})`
442
421
  )
@@ -445,7 +424,7 @@ const keywords = {
445
424
  [KEYWORDS.EQUAL]: (args, env) => {
446
425
  if (args.length !== 2)
447
426
  throw new RangeError(
448
- `Invalid number of arguments for (${KEYWORDS.EQUAL}) (2 required) (${
427
+ `Invalid number of arguments for (${KEYWORDS.EQUAL}) (= 2 required) (${
449
428
  KEYWORDS.EQUAL
450
429
  } ${stringifyArgs(args)})`
451
430
  )
@@ -470,7 +449,7 @@ const keywords = {
470
449
  throw new RangeError(
471
450
  `Invalid number of arguments for (${
472
451
  KEYWORDS.LESS_THAN
473
- }) (2 required) (${KEYWORDS.LESS_THAN} ${stringifyArgs(args)})`
452
+ }) (= 2 required) (${KEYWORDS.LESS_THAN} ${stringifyArgs(args)})`
474
453
  )
475
454
  const a = evaluate(args[0], env)
476
455
  const b = evaluate(args[1], env)
@@ -493,7 +472,7 @@ const keywords = {
493
472
  throw new RangeError(
494
473
  `Invalid number of arguments for (${
495
474
  KEYWORDS.GREATHER_THAN
496
- }) (2 required) (${KEYWORDS.GREATHER_THAN} ${stringifyArgs(args)})`
475
+ }) (= 2 required) (${KEYWORDS.GREATHER_THAN} ${stringifyArgs(args)})`
497
476
  )
498
477
  const a = evaluate(args[0], env)
499
478
  const b = evaluate(args[1], env)
@@ -520,7 +499,7 @@ const keywords = {
520
499
  throw new RangeError(
521
500
  `Invalid number of arguments for (${
522
501
  KEYWORDS.GREATHER_THAN_OR_EQUAL
523
- }) (2 required) (${KEYWORDS.GREATHER_THAN_OR_EQUAL} ${stringifyArgs(
502
+ }) (= 2 required) (${KEYWORDS.GREATHER_THAN_OR_EQUAL} ${stringifyArgs(
524
503
  args
525
504
  )})`
526
505
  )
@@ -549,7 +528,9 @@ const keywords = {
549
528
  throw new RangeError(
550
529
  `Invalid number of arguments for (${
551
530
  KEYWORDS.LESS_THAN_OR_EQUAL
552
- }) (2 required) (${KEYWORDS.LESS_THAN_OR_EQUAL} ${stringifyArgs(args)})`
531
+ }) (= 2 required) (${KEYWORDS.LESS_THAN_OR_EQUAL} ${stringifyArgs(
532
+ args
533
+ )})`
553
534
  )
554
535
  const a = evaluate(args[0], env)
555
536
  const b = evaluate(args[1], env)
@@ -764,7 +745,7 @@ const keywords = {
764
745
  throw new RangeError(
765
746
  `Invalid number of arguments to (${
766
747
  KEYWORDS.BITWISE_NOT
767
- }) (1 required). (${KEYWORDS.BITWISE_NOT} ${stringifyArgs(args)})`
748
+ }) (= 1 required). (${KEYWORDS.BITWISE_NOT} ${stringifyArgs(args)})`
768
749
  )
769
750
  const operand = evaluate(args[0], env)
770
751
  if (typeof operand !== 'number')
@@ -889,7 +870,7 @@ const keywords = {
889
870
  throw new RangeError(
890
871
  `Invalid number of arguments to (${
891
872
  KEYWORDS.THROW_ERROR
892
- }) (1 required). (${KEYWORDS.THROW_ERROR} ${stringifyArgs(args)})`
873
+ }) (= 1 required). (${KEYWORDS.THROW_ERROR} ${stringifyArgs(args)})`
893
874
  )
894
875
  const string = evaluate(args[0], env)
895
876
  if (typeof string !== 'string')
@@ -916,18 +897,6 @@ const keywords = {
916
897
  )
917
898
  return arrays.reduce((a, b) => a.concat(b), [])
918
899
  },
919
- [KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION]: (args, env) => {
920
- if (!args.length)
921
- throw new RangeError(
922
- `Invalid number of arguments to (${
923
- KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION
924
- }) (>= 2 required). (${
925
- KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION
926
- } ${stringifyArgs(args)})`
927
- )
928
- // TODO: Add validation for TCO recursion
929
- return keywords[KEYWORDS.DEFINE_VARIABLE](args, env)
930
- },
931
900
  [KEYWORDS.IMMUTABLE_FUNCTION]: (args, env) => {
932
901
  if (!args.length)
933
902
  throw new RangeError(
@@ -969,6 +938,18 @@ const keywords = {
969
938
  return evaluate(body, localEnv)
970
939
  }
971
940
  },
941
+ [KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION]: (args, env) => {
942
+ if (!args.length)
943
+ throw new RangeError(
944
+ `Invalid number of arguments to (${
945
+ KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION
946
+ }) (>= 2 required). (${
947
+ KEYWORDS.TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION
948
+ } ${stringifyArgs(args)})`
949
+ )
950
+ // TODO: Add validation for TCO recursion
951
+ return keywords[KEYWORDS.DEFINE_VARIABLE](args, env)
952
+ },
972
953
  [KEYWORDS.TEST_CASE]: (args, env) => {
973
954
  if (args.length !== 3)
974
955
  throw new RangeError(
@@ -1090,85 +1071,26 @@ const keywords = {
1090
1071
  }
1091
1072
  return array
1092
1073
  },
1093
-
1094
- [KEYWORDS.SET_IMMUTABLE_ARRAY]: (args, env) => {
1095
- if (args.length !== 2 && args.length !== 3)
1074
+ [KEYWORDS.LOG]: (args, env) => {
1075
+ if (!args.length)
1096
1076
  throw new RangeError(
1097
- `Invalid number of arguments for (${
1098
- KEYWORDS.SET_IMMUTABLE_ARRAY
1099
- }) (or 2 3) required (${KEYWORDS.SET_IMMUTABLE_ARRAY} ${stringifyArgs(
1100
- args
1101
- )})`
1102
- )
1103
- let array = evaluate(args[0], env)
1104
- if (!Array.isArray(array))
1105
- throw new TypeError(
1106
- `First argument of (${KEYWORDS.SET_IMMUTABLE_ARRAY}) must be an (${
1107
- KEYWORDS.ARRAY_TYPE
1108
- }) but got (${array}) (${KEYWORDS.SET_IMMUTABLE_ARRAY} ${stringifyArgs(
1109
- args
1110
- )})`
1111
- )
1112
- array = [...array]
1113
- const index = evaluate(args[1], env)
1114
- if (!Number.isInteger(index))
1115
- throw new TypeError(
1116
- `Second argument of (${KEYWORDS.SET_IMMUTABLE_ARRAY}) must be an (${
1117
- KEYWORDS.NUMBER_TYPE
1118
- } integer) (${index}) (${KEYWORDS.SET_IMMUTABLE_ARRAY} ${stringifyArgs(
1119
- args
1120
- )})`
1077
+ `Invalid number of arguments to (${KEYWORDS.LOG}) (>= 1 required) (${
1078
+ KEYWORDS.LOG
1079
+ } ${stringifyArgs(args)})`
1121
1080
  )
1122
- if (index > array.length)
1081
+ const expressions = args.map((x) => evaluate(x, env))
1082
+ console.log(...expressions)
1083
+ return expressions.at(-1)
1084
+ },
1085
+ [KEYWORDS.CLEAR_CONSOLE]: (args) => {
1086
+ if (args.length)
1123
1087
  throw new RangeError(
1124
- `Second argument of (${
1125
- KEYWORDS.SET_IMMUTABLE_ARRAY
1126
- }) is outside of the (${
1127
- KEYWORDS.ARRAY_TYPE
1128
- }) bounds (index ${index} bounds ${array.length}) (${
1129
- KEYWORDS.SET_IMMUTABLE_ARRAY
1130
- } ${stringifyArgs(args)})`
1088
+ `Invalid number of arguments to (${
1089
+ KEYWORDS.CLEAR_CONSOLE
1090
+ }) (= 0 required) (${KEYWORDS.CLEAR_CONSOLE} ${stringifyArgs(args)})`
1131
1091
  )
1132
- if (index < 0) {
1133
- if (args.length !== 2)
1134
- throw new RangeError(
1135
- `Invalid number of arguments for (${
1136
- KEYWORDS.SET_IMMUTABLE_ARRAY
1137
- }) (if (< index 0) then 2 required) (${
1138
- KEYWORDS.SET_IMMUTABLE_ARRAY
1139
- } ${stringifyArgs(args)})`
1140
- )
1141
- if (index * -1 > array.length)
1142
- throw new RangeError(
1143
- `Second argument of (${
1144
- KEYWORDS.SET_IMMUTABLE_ARRAY
1145
- }) is outside of the (${
1146
- KEYWORDS.ARRAY_TYPE
1147
- }) bounds (index ${index} bounds ${array.length}) (${
1148
- KEYWORDS.SET_IMMUTABLE_ARRAY
1149
- } ${stringifyArgs(args)})`
1150
- )
1151
- const target = array.length + index
1152
- while (array.length !== target) array.pop()
1153
- } else {
1154
- if (args.length !== 3)
1155
- throw new RangeError(
1156
- `Invalid number of arguments for (${
1157
- KEYWORDS.SET_IMMUTABLE_ARRAY
1158
- }) (if (>= index 0) then 3 required) (${
1159
- KEYWORDS.SET_IMMUTABLE_ARRAY
1160
- } ${stringifyArgs(args)})`
1161
- )
1162
- const value = evaluate(args[2], env)
1163
- if (value == undefined)
1164
- throw new RangeError(
1165
- `Trying to set a null value in (${KEYWORDS.ARRAY_TYPE}) at (${
1166
- KEYWORDS.SET_IMMUTABLE_ARRAY
1167
- }). (${KEYWORDS.SET_IMMUTABLE_ARRAY} ${stringifyArgs(args)})`
1168
- )
1169
- array[index] = value
1170
- }
1171
- return array
1092
+ console.clear()
1093
+ return 0
1172
1094
  },
1173
1095
  }
1174
1096
  keywords[KEYWORDS.NOT_COMPILED_BLOCK] = keywords[KEYWORDS.BLOCK]
package/src/utils.js CHANGED
@@ -186,7 +186,12 @@ export const fez = (source, options = {}) => {
186
186
  )
187
187
  else code = removeNoCode(source)
188
188
  if (!options.mutation) code = removeMutation(code)
189
+ if (!code.length && options.throw) throw new Error('Nothing to parse!')
189
190
  const parsed = parse(code)
191
+ if (parsed.length === 0 && options.throw)
192
+ throw new Error(
193
+ 'Top level expressions need to be wrapped in a (do) block'
194
+ )
190
195
  const standard = options.std
191
196
  ? options.shake
192
197
  ? treeShake(parsed, std)
@@ -202,9 +207,8 @@ export const fez = (source, options = {}) => {
202
207
  const err = error.message
203
208
  .replace("'[object Array]'", '(array)')
204
209
  .replace('object', '(array)')
205
- if (options.errors) {
206
- logError(err)
207
- }
210
+ if (options.errors) logError(err)
211
+ if (options.throw) throw err
208
212
  return err
209
213
  }
210
214
  }