fez-lisp 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +14 -6
- package/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/interpreter.js +7 -1
- package/src/utils.js +23 -8
- package/lib/src/std.lisp +0 -275
package/README.md
CHANGED
@@ -71,19 +71,24 @@
|
|
71
71
|
<p align="center">
|
72
72
|
<img width="64" src="./js.svg"/>
|
73
73
|
</p>
|
74
|
+
Installation:
|
75
|
+
|
76
|
+
```
|
77
|
+
npm i fez-lisp
|
78
|
+
```
|
74
79
|
|
75
80
|
```js
|
76
|
-
import { fez } from '
|
81
|
+
import { fez } from 'fez-lisp'
|
77
82
|
fez(`(log! "Hello World!")`)
|
78
83
|
```
|
79
84
|
|
80
85
|
```js
|
81
|
-
import { fez } from '
|
86
|
+
import { fez } from 'fez-lisp'
|
82
87
|
fez(`(+ 1 "2")`, { errors: true })
|
83
88
|
```
|
84
89
|
|
85
90
|
```js
|
86
|
-
import { fez } from '
|
91
|
+
import { fez } from 'fez-lisp'
|
87
92
|
eval(
|
88
93
|
fez(
|
89
94
|
`(go
|
@@ -97,9 +102,11 @@ eval(
|
|
97
102
|
)
|
98
103
|
)
|
99
104
|
```
|
105
|
+
|
100
106
|
```js
|
101
|
-
import { fez } from '
|
102
|
-
fez(
|
107
|
+
import { fez } from 'fez-lisp'
|
108
|
+
fez(
|
109
|
+
`(let fizz-buzz (lambda n
|
103
110
|
(cond
|
104
111
|
(= (mod n 15) 0) "Fizz Buzz"
|
105
112
|
(= (mod n 3) 0) "Fizz"
|
@@ -107,5 +114,6 @@ fez(`(let fizz-buzz (lambda n
|
|
107
114
|
(*) n)))
|
108
115
|
|
109
116
|
(go (range 1 100) (scan fizz-buzz) (log!))`,
|
110
|
-
{ std: true, errors: true, compile: false, shake: true }
|
117
|
+
{ std: true, errors: true, compile: false, shake: true }
|
118
|
+
)
|
111
119
|
```
|
package/lib/baked/std.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default [[{"t":"f","v":"let"},{"t":"w","v":"E"},{"t":"a","v":2.718281828459045}],[{"t":"f","v":"let"},{"t":"w","v":"PI"},{"t":"a","v":3.141592653589793}],[{"t":"f","v":"let*"},{"t":"w","v":"iteration"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"iteration"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],{"t":"w","v":"callback"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"select"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"exclude"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},{"t":"w","v":"initial"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"callback"},{"t":"w","v":"out"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},{"t":"w","v":"initial"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"every?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]],[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"some?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]],[{"t":"f","v":"type"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],{"t":"w","v":"Boolean"}]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"find"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"has?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],{"t":"a","v":1},[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"reverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"merge"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<="},{"t":"w","v":"count"},{"t":"w","v":"end"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"w","v":"start"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sequence"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"end"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},[{"t":"f","v":"length"},{"t":"w","v":"out"}],{"t":"w","v":"end"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sequence-n"},[{"t":"f","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},[{"t":"f","v":"length"},{"t":"w","v":"out"}],{"t":"w","v":"n"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"unique"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"sort"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"zip"},[{"t":"f","v":"sequence"},{"t":"w","v":"sorted"}]],[{"t":"f","v":"select"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"or"},[{"t":"f","v":"not"},[{"t":"f","v":"let"},{"t":"w","v":"index"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"x"}]]]],[{"t":"f","v":"not"},[{"t":"f","v":"="},[{"t":"f","v":"get"},{"t":"w","v":"sorted"},[{"t":"f","v":"-"},{"t":"w","v":"index"},{"t":"a","v":1}]],[{"t":"f","v":"get"},{"t":"w","v":"sorted"},{"t":"w","v":"index"}]]]]]],[{"t":"f","v":"scan"},{"t":"w","v":"car"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"for-range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"when"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"end"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},{"t":"w","v":"i"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"start"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"list-range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"range"},[{"t":"f","v":"lambda"},{"t":"w","v":"list"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"start"},{"t":"w","v":"end"}],[{"t":"f","v":"Array"},[{"t":"f","v":"merge"},{"t":"w","v":"list"},[{"t":"f","v":"range"},[{"t":"f","v":"Array"},[{"t":"f","v":"Array"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"a","v":1}]]],[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"a","v":1}],{"t":"w","v":"end"}]]],{"t":"w","v":"list"}]]],[{"t":"f","v":"car"},[{"t":"f","v":"car"},[{"t":"f","v":"range"},[],{"t":"w","v":"start"},{"t":"w","v":"end"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"traverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"callback"},[{"t":"f","v":"if"},[{"t":"f","v":"Atom?"},{"t":"w","v":"x"}],[{"t":"f","v":"callback"},{"t":"w","v":"x"}],[{"t":"f","v":"iterate"},{"t":"w","v":"x"},[{"t":"f","v":"lambda"},{"t":"w","v":"y"},[{"t":"f","v":"traverse"},{"t":"w","v":"y"},{"t":"w","v":"callback"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"summation"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"+"},{"t":"w","v":"a"},{"t":"w","v":"b"}]],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"product"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"b"}]],{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"maximum"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"minimum"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"max"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"min"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"count-of"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"select"},{"t":"w","v":"callback"}],[{"t":"f","v":"length"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"increment"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"floor"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"|"},{"t":"w","v":"n"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"round"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"|"},[{"t":"f","v":"+"},{"t":"w","v":"n"},{"t":"a","v":0.5}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"empty?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array-in-bounds?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"index"},[{"t":"f","v":"and"},[{"t":"f","v":"<"},{"t":"w","v":"index"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]],[{"t":"f","v":">="},{"t":"w","v":"index"},{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"string->array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"string"},{"t":"w","v":"Array"}]]],[{"t":"f","v":"let"},{"t":"w","v":"array->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"x"},[{"t":"f","v":"concatenate"},{"t":"w","v":"a"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"String"}]]],{"t":"a","v":""}]]],[{"t":"f","v":"let"},{"t":"w","v":"string->number"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"string"},{"t":"w","v":"Number"}]]],[{"t":"f","v":"let"},{"t":"w","v":"number->string"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"number"},[{"t":"f","v":"type"},{"t":"w","v":"number"},{"t":"w","v":"String"}]]],[{"t":"f","v":"let"},{"t":"w","v":"strings->numbers"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Number"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"numbers->strings"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"String"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"string->charcodes"},[{"t":"f","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"go"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"Array"}],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char-Code"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"chars->charcodes"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char-Code"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"charcodes->chars"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"charcodes->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char"}]]],[{"t":"f","v":"array->string"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"power"},[{"t":"f","v":"lambda"},{"t":"w","v":"base"},{"t":"w","v":"exp"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"exp"},{"t":"a","v":0}],[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"base"},{"t":"a","v":0}],[{"t":"f","v":"throw"},{"t":"a","v":"Attempting to divide by 0 in (power)"}],[{"t":"f","v":"/"},[{"t":"f","v":"*"},{"t":"w","v":"base"},[{"t":"f","v":"power"},{"t":"w","v":"base"},[{"t":"f","v":"-"},[{"t":"f","v":"*"},{"t":"w","v":"exp"},{"t":"a","v":-1}],{"t":"a","v":1}]]]]],[{"t":"f","v":"cond"},[{"t":"f","v":"="},{"t":"w","v":"exp"},{"t":"a","v":0}],{"t":"a","v":1},[{"t":"f","v":"="},{"t":"w","v":"exp"},{"t":"a","v":1}],{"t":"w","v":"base"},[{"t":"f","v":"*"}],[{"t":"f","v":"*"},{"t":"w","v":"base"},[{"t":"f","v":"power"},{"t":"w","v":"base"},[{"t":"f","v":"-"},{"t":"w","v":"exp"},{"t":"a","v":1}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"greatest-common-divisor"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"gcd"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"b"},{"t":"a","v":0}],{"t":"w","v":"a"},[{"t":"f","v":"gcd"},{"t":"w","v":"b"},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"gcd"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"least-common-divisor"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"/"},[{"t":"f","v":"greatest-common-divisor"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"sqrt"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"is-good-enough"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"<"},[{"t":"f","v":"abs"},[{"t":"f","v":"-"},[{"t":"f","v":"square"},{"t":"w","v":"g"}],{"t":"w","v":"x"}]],{"t":"a","v":0.01}]],{"t":"w","v":"improve-guess"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"average"},{"t":"w","v":"g"},[{"t":"f","v":"*"},{"t":"w","v":"x"},[{"t":"f","v":"/"},{"t":"w","v":"g"}]]]]],[{"t":"f","v":"let*"},{"t":"w","v":"sqrt-iter"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"if"},[{"t":"f","v":"is-good-enough"},{"t":"w","v":"g"},{"t":"w","v":"x"}],{"t":"w","v":"g"},[{"t":"f","v":"sqrt-iter"},[{"t":"f","v":"improve-guess"},{"t":"w","v":"g"},{"t":"w","v":"x"}],{"t":"w","v":"x"}]]]],[{"t":"f","v":"sqrt-iter"},{"t":"a","v":1},{"t":"w","v":"x"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"circumference"},[{"t":"f","v":"lambda"},{"t":"w","v":"radius"},[{"t":"f","v":"*"},{"t":"w","v":"PI"},[{"t":"f","v":"*"},{"t":"w","v":"radius"},{"t":"a","v":2}]]]],[{"t":"f","v":"let"},{"t":"w","v":"hypotenuse"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"sqrt"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"b"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"abs"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"-"},[{"t":"f","v":"^"},{"t":"w","v":"n"},[{"t":"f","v":">>"},{"t":"w","v":"n"},{"t":"a","v":31}]],[{"t":"f","v":">>"},{"t":"w","v":"n"},{"t":"a","v":31}]]]],[{"t":"f","v":"let"},{"t":"w","v":"nth-digit"},[{"t":"f","v":"lambda"},{"t":"w","v":"digit"},{"t":"w","v":"n"},[{"t":"f","v":"|"},[{"t":"f","v":"mod"},[{"t":"f","v":"/"},{"t":"w","v":"digit"},[{"t":"f","v":"power"},{"t":"a","v":10},[{"t":"f","v":"-"},{"t":"w","v":"n"},{"t":"a","v":1}]]],{"t":"a","v":10}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"normalize"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"value"},{"t":"w","v":"min"},{"t":"w","v":"max"},[{"t":"f","v":"*"},[{"t":"f","v":"-"},{"t":"w","v":"value"},{"t":"w","v":"min"}],[{"t":"f","v":"/"},[{"t":"f","v":"-"},{"t":"w","v":"max"},{"t":"w","v":"min"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"linear-interpolation"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},{"t":"w","v":"n"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},[{"t":"f","v":"-"},{"t":"a","v":1},{"t":"w","v":"n"}],{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"n"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"gauss-sum"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"*"},{"t":"w","v":"n"},[{"t":"f","v":"+"},{"t":"w","v":"n"},{"t":"a","v":1}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"gauss-sum-sequance"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"a"},{"t":"w","v":"b"}],[{"t":"f","v":"+"},[{"t":"f","v":"-"},{"t":"w","v":"b"},{"t":"w","v":"a"}],{"t":"a","v":1}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"clamp"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"limit"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"x"},{"t":"w","v":"limit"}],{"t":"w","v":"limit"},{"t":"w","v":"x"}]]],[{"t":"f","v":"let"},{"t":"w","v":"odd?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"x"},{"t":"a","v":2}],{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"even?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"x"},{"t":"a","v":2}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"sign"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"n"},{"t":"a","v":0}],{"t":"a","v":-1},{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"radians"},[{"t":"f","v":"lambda"},{"t":"w","v":"deg"},[{"t":"f","v":"*"},{"t":"w","v":"deg"},{"t":"w","v":"PI"},[{"t":"f","v":"/"},{"t":"a","v":180}]]]],[{"t":"f","v":"let"},{"t":"w","v":"average"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"y"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"x"},{"t":"w","v":"y"}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"euclidean-mod"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"mod"},[{"t":"f","v":"+"},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"b"}],{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"euclidean-distance"},[{"t":"f","v":"lambda"},{"t":"w","v":"x1"},{"t":"w","v":"y1"},{"t":"w","v":"x2"},{"t":"w","v":"y2"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"a"},[{"t":"f","v":"-"},{"t":"w","v":"x1"},{"t":"w","v":"x2"}]],[{"t":"f","v":"let"},{"t":"w","v":"b"},[{"t":"f","v":"-"},{"t":"w","v":"y1"},{"t":"w","v":"y2"}]],[{"t":"f","v":"sqrt"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"b"},{"t":"w","v":"b"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"manhattan-distance"},[{"t":"f","v":"lambda"},{"t":"w","v":"x1"},{"t":"w","v":"y1"},{"t":"w","v":"x2"},{"t":"w","v":"y2"},[{"t":"f","v":"+"},[{"t":"f","v":"abs"},[{"t":"f","v":"-"},{"t":"w","v":"x2"},{"t":"w","v":"x1"}]],[{"t":"f","v":"abs"},[{"t":"f","v":"-"},{"t":"w","v":"y2"},{"t":"w","v":"y1"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"positive?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":">"},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"negative?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":"<"},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"zero?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":"="},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"divisible?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"prime?"},[{"t":"f","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"cond"},[{"t":"f","v":"="},{"t":"w","v":"n"},{"t":"a","v":1}],{"t":"a","v":0},[{"t":"f","v":"<"},{"t":"w","v":"n"},{"t":"a","v":0}],{"t":"a","v":0},[{"t":"f","v":"*"}],[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iter"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"it-is"},[{"t":"f","v":"not"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"n"},{"t":"w","v":"i"}],{"t":"a","v":0}]]],[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"<="},{"t":"w","v":"i"},{"t":"w","v":"end"}],{"t":"w","v":"it-is"}],[{"t":"f","v":"iter"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],{"t":"w","v":"end"}],{"t":"w","v":"it-is"}]]]],[{"t":"f","v":"or"},[{"t":"f","v":"="},{"t":"w","v":"n"},{"t":"a","v":2}],[{"t":"f","v":"iter"},{"t":"a","v":2},[{"t":"f","v":"sqrt"},{"t":"w","v":"n"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"slice"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"bounds"},[{"t":"f","v":"-"},{"t":"w","v":"end"},{"t":"w","v":"start"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"bounds"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"get"},{"t":"w","v":"array"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"w","v":"i"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"a","v":0},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"binary-search"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"target"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"search"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"target"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"when"},[{"t":"f","v":"<="},{"t":"w","v":"start"},{"t":"w","v":"end"}],[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"index"},[{"t":"f","v":"floor"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"w","v":"end"}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"current"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"index"}]],[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"target"},{"t":"w","v":"current"}],{"t":"w","v":"target"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"current"},{"t":"w","v":"target"}],[{"t":"f","v":"search"},{"t":"w","v":"arr"},{"t":"w","v":"target"},{"t":"w","v":"start"},[{"t":"f","v":"-"},{"t":"w","v":"index"},{"t":"a","v":1}]],[{"t":"f","v":"search"},{"t":"w","v":"arr"},{"t":"w","v":"target"},[{"t":"f","v":"+"},{"t":"w","v":"index"},{"t":"a","v":1}],{"t":"w","v":"end"}]]]]]]]],[{"t":"f","v":"search"},{"t":"w","v":"array"},{"t":"w","v":"target"},{"t":"a","v":0},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"zip"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"A"},{"t":"w","v":"B"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},{"t":"w","v":"output"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"a"}],[{"t":"f","v":"length"},{"t":"w","v":"b"}]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"a"}],[{"t":"f","v":"cdr"},{"t":"w","v":"b"}],[{"t":"f","v":"merge"},{"t":"w","v":"output"},[{"t":"f","v":"Array"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"a"}],[{"t":"f","v":"car"},{"t":"w","v":"b"}]]]]],{"t":"w","v":"output"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"A"},{"t":"w","v":"B"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"cartesian-product"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"fold"},{"t":"w","v":"a"},[{"t":"f","v":"lambda"},{"t":"w","v":"p"},{"t":"w","v":"x"},[{"t":"f","v":"merge"},{"t":"w","v":"p"},[{"t":"f","v":"scan"},{"t":"w","v":"b"},[{"t":"f","v":"lambda"},{"t":"w","v":"y"},[{"t":"f","v":"Array"},{"t":"w","v":"x"},{"t":"w","v":"y"}]]]]],[]]]],[{"t":"f","v":"let"},{"t":"w","v":"equal?"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"or"},[{"t":"f","v":"and"},[{"t":"f","v":"Atom?"},{"t":"w","v":"a"}],[{"t":"f","v":"Atom?"},{"t":"w","v":"b"}],[{"t":"f","v":"="},{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"and"},[{"t":"f","v":"Array?"},{"t":"w","v":"a"}],[{"t":"f","v":"="},[{"t":"f","v":"length"},{"t":"w","v":"a"}],[{"t":"f","v":"length"},{"t":"w","v":"b"}]],[{"t":"f","v":"not"},[{"t":"f","v":"some?"},[{"t":"f","v":"sequence"},{"t":"w","v":"a"}],[{"t":"f","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"not"},[{"t":"f","v":"equal?"},[{"t":"f","v":"get"},{"t":"w","v":"a"},{"t":"w","v":"i"}],[{"t":"f","v":"get"},{"t":"w","v":"b"},{"t":"w","v":"i"}]]]]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"split"},[{"t":"f","v":"lambda"},{"t":"w","v":"string"},{"t":"w","v":"delim"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"input"},[{"t":"f","v":"type"},[{"t":"f","v":"concatenate"},{"t":"w","v":"string"},{"t":"w","v":"delim"}],{"t":"w","v":"Array"}]],[{"t":"f","v":"let"},{"t":"w","v":"marks"},[{"t":"f","v":"go"},{"t":"w","v":"input"},[{"t":"f","v":"zip"},[{"t":"f","v":"sequence"},{"t":"w","v":"input"}]],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"if"},[{"t":"f","v":"="},[{"t":"f","v":"car"},{"t":"w","v":"x"}],{"t":"w","v":"delim"}],[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"x"}]],[{"t":"f","v":"car"},{"t":"w","v":"x"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"first"},[{"t":"f","v":"find"},{"t":"w","v":"marks"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"Number?"},{"t":"w","v":"x"}]]]],[{"t":"f","v":"go"},{"t":"w","v":"marks"},[{"t":"f","v":"fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"Number?"},{"t":"w","v":"b"}],[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"Array"},[{"t":"f","v":"slice"},{"t":"w","v":"input"},[{"t":"f","v":"-"},{"t":"w","v":"b"},{"t":"w","v":"first"}],{"t":"w","v":"b"}]]],{"t":"w","v":"a"}]],[]],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"array->string"},{"t":"w","v":"x"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"join"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"delim"},[{"t":"f","v":"fold"},[{"t":"f","v":"zip"},{"t":"w","v":"array"},[{"t":"f","v":"sequence"},{"t":"w","v":"array"}]],[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"b"}]],{"t":"a","v":0}],[{"t":"f","v":"concatenate"},{"t":"w","v":"a"},{"t":"w","v":"delim"},[{"t":"f","v":"type"},[{"t":"f","v":"car"},{"t":"w","v":"b"}],{"t":"w","v":"String"}]],[{"t":"f","v":"type"},[{"t":"f","v":"car"},{"t":"w","v":"b"}],{"t":"w","v":"String"}]]],{"t":"a","v":""}]]],[{"t":"f","v":"let"},{"t":"w","v":"flat"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"flatten"},[{"t":"f","v":"lambda"},{"t":"w","v":"item"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"Array?"},{"t":"w","v":"item"}],[{"t":"f","v":"length"},{"t":"w","v":"item"}]],[{"t":"f","v":"fold"},{"t":"w","v":"item"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"flatten"},{"t":"w","v":"b"}]]],[]],[{"t":"f","v":"Array"},{"t":"w","v":"item"}]]]],[{"t":"f","v":"flatten"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sort"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"if"},[{"t":"f","v":"<="},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"a","v":1}],{"t":"w","v":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"pivot"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"bounds"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"current"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"i"}]],[{"t":"f","v":"let"},{"t":"w","v":"predicate"},[{"t":"f","v":"callback"},{"t":"w","v":"current"},{"t":"w","v":"pivot"}]],[{"t":"f","v":"let"},{"t":"w","v":"left"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"predicate"},{"t":"a","v":0}],[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"Array"},{"t":"w","v":"current"}]],{"t":"w","v":"a"}]],[{"t":"f","v":"let"},{"t":"w","v":"right"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"predicate"},{"t":"a","v":1}],[{"t":"f","v":"merge"},{"t":"w","v":"b"},[{"t":"f","v":"Array"},{"t":"w","v":"current"}]],{"t":"w","v":"b"}]],[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"bounds"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],{"t":"w","v":"bounds"},{"t":"w","v":"left"},{"t":"w","v":"right"}],[{"t":"f","v":"Array"},{"t":"w","v":"left"},{"t":"w","v":"right"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"iterate"},{"t":"a","v":1},[{"t":"f","v":"-"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"a","v":1}],[],[]]],[{"t":"f","v":"let"},{"t":"w","v":"left"},[{"t":"f","v":"car"},{"t":"w","v":"sorted"}]],[{"t":"f","v":"let"},{"t":"w","v":"right"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"sorted"}]]],[{"t":"f","v":"merge"},[{"t":"f","v":"sort"},{"t":"w","v":"left"},{"t":"w","v":"callback"}],[{"t":"f","v":"Array"},{"t":"w","v":"pivot"}],[{"t":"f","v":"sort"},{"t":"w","v":"right"},{"t":"w","v":"callback"}]]]]]]]]
|
1
|
+
export default [[{"t":"f","v":"let"},{"t":"w","v":"E"},{"t":"a","v":2.718281828459045}],[{"t":"f","v":"let"},{"t":"w","v":"PI"},{"t":"a","v":3.141592653589793}],[{"t":"f","v":"let*"},{"t":"w","v":"iteration"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"iteration"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],{"t":"w","v":"callback"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"select"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"exclude"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},{"t":"w","v":"initial"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"callback"},{"t":"w","v":"out"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},{"t":"w","v":"initial"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"every?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]],[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"some?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]],[{"t":"f","v":"type"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],{"t":"w","v":"Boolean"}]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"find"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"has?"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],{"t":"a","v":1},[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"reverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"array"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"array"}],[{"t":"f","v":"merge"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"array"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<="},{"t":"w","v":"count"},{"t":"w","v":"end"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"w","v":"start"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sequence"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"end"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},[{"t":"f","v":"length"},{"t":"w","v":"out"}],{"t":"w","v":"end"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sequence-n"},[{"t":"f","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"out"},{"t":"w","v":"count"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},[{"t":"f","v":"length"},{"t":"w","v":"out"}],{"t":"w","v":"n"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},{"t":"w","v":"count"}]],[{"t":"f","v":"+"},{"t":"w","v":"count"},{"t":"a","v":1}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},[],{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"unique"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"sort"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"zip"},[{"t":"f","v":"sequence"},{"t":"w","v":"sorted"}]],[{"t":"f","v":"select"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"or"},[{"t":"f","v":"not"},[{"t":"f","v":"let"},{"t":"w","v":"index"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"x"}]]]],[{"t":"f","v":"not"},[{"t":"f","v":"="},[{"t":"f","v":"get"},{"t":"w","v":"sorted"},[{"t":"f","v":"-"},{"t":"w","v":"index"},{"t":"a","v":1}]],[{"t":"f","v":"get"},{"t":"w","v":"sorted"},{"t":"w","v":"index"}]]]]]],[{"t":"f","v":"scan"},{"t":"w","v":"car"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"for-range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"when"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"end"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},{"t":"w","v":"i"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"start"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"list-range"},[{"t":"f","v":"lambda"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"range"},[{"t":"f","v":"lambda"},{"t":"w","v":"list"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"start"},{"t":"w","v":"end"}],[{"t":"f","v":"Array"},[{"t":"f","v":"merge"},{"t":"w","v":"list"},[{"t":"f","v":"range"},[{"t":"f","v":"Array"},[{"t":"f","v":"Array"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"a","v":1}]]],[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"a","v":1}],{"t":"w","v":"end"}]]],{"t":"w","v":"list"}]]],[{"t":"f","v":"car"},[{"t":"f","v":"car"},[{"t":"f","v":"range"},[],{"t":"w","v":"start"},{"t":"w","v":"end"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"traverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"callback"},[{"t":"f","v":"if"},[{"t":"f","v":"Atom?"},{"t":"w","v":"x"}],[{"t":"f","v":"callback"},{"t":"w","v":"x"}],[{"t":"f","v":"iterate"},{"t":"w","v":"x"},[{"t":"f","v":"lambda"},{"t":"w","v":"y"},[{"t":"f","v":"traverse"},{"t":"w","v":"y"},{"t":"w","v":"callback"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"summation"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"+"},{"t":"w","v":"a"},{"t":"w","v":"b"}]],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"product"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"b"}]],{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"maximum"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"minimum"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"car"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"max"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"min"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"a"},{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"count-of"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"select"},{"t":"w","v":"callback"}],[{"t":"f","v":"length"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"increment"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"floor"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"|"},{"t":"w","v":"n"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"round"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"|"},[{"t":"f","v":"+"},{"t":"w","v":"n"},{"t":"a","v":0.5}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"empty?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array-in-bounds?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"index"},[{"t":"f","v":"and"},[{"t":"f","v":"<"},{"t":"w","v":"index"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]],[{"t":"f","v":">="},{"t":"w","v":"index"},{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"string->array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"string"},{"t":"w","v":"Array"}]]],[{"t":"f","v":"let"},{"t":"w","v":"array->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"fold"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"x"},[{"t":"f","v":"concatenate"},{"t":"w","v":"a"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"String"}]]],{"t":"a","v":""}]]],[{"t":"f","v":"let"},{"t":"w","v":"string->number"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"string"},{"t":"w","v":"Number"}]]],[{"t":"f","v":"let"},{"t":"w","v":"number->string"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"number"},[{"t":"f","v":"type"},{"t":"w","v":"number"},{"t":"w","v":"String"}]]],[{"t":"f","v":"let"},{"t":"w","v":"strings->numbers"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Number"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"numbers->strings"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},{"t":"w","v":"array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"String"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"string->charcodes"},[{"t":"f","v":"lambda"},{"t":"w","v":"string"},[{"t":"f","v":"go"},{"t":"w","v":"string"},[{"t":"f","v":"type"},{"t":"w","v":"Array"}],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char-Code"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"chars->charcodes"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char-Code"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"charcodes->chars"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"charcodes->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"go"},{"t":"w","v":"array"},[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"Char"}]]],[{"t":"f","v":"array->string"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"power"},[{"t":"f","v":"lambda"},{"t":"w","v":"base"},{"t":"w","v":"exp"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"exp"},{"t":"a","v":0}],[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"base"},{"t":"a","v":0}],[{"t":"f","v":"throw"},{"t":"a","v":"Attempting to divide by 0 in (power)"}],[{"t":"f","v":"/"},[{"t":"f","v":"*"},{"t":"w","v":"base"},[{"t":"f","v":"power"},{"t":"w","v":"base"},[{"t":"f","v":"-"},[{"t":"f","v":"*"},{"t":"w","v":"exp"},{"t":"a","v":-1}],{"t":"a","v":1}]]]]],[{"t":"f","v":"cond"},[{"t":"f","v":"="},{"t":"w","v":"exp"},{"t":"a","v":0}],{"t":"a","v":1},[{"t":"f","v":"="},{"t":"w","v":"exp"},{"t":"a","v":1}],{"t":"w","v":"base"},[{"t":"f","v":"*"}],[{"t":"f","v":"*"},{"t":"w","v":"base"},[{"t":"f","v":"power"},{"t":"w","v":"base"},[{"t":"f","v":"-"},{"t":"w","v":"exp"},{"t":"a","v":1}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"greatest-common-divisor"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"gcd"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"b"},{"t":"a","v":0}],{"t":"w","v":"a"},[{"t":"f","v":"gcd"},{"t":"w","v":"b"},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"gcd"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"least-common-divisor"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"/"},[{"t":"f","v":"greatest-common-divisor"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"sqrt"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"is-good-enough"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"<"},[{"t":"f","v":"abs"},[{"t":"f","v":"-"},[{"t":"f","v":"square"},{"t":"w","v":"g"}],{"t":"w","v":"x"}]],{"t":"a","v":0.01}]],{"t":"w","v":"improve-guess"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"average"},{"t":"w","v":"g"},[{"t":"f","v":"*"},{"t":"w","v":"x"},[{"t":"f","v":"/"},{"t":"w","v":"g"}]]]]],[{"t":"f","v":"let*"},{"t":"w","v":"sqrt-iter"},[{"t":"f","v":"lambda"},{"t":"w","v":"g"},{"t":"w","v":"x"},[{"t":"f","v":"if"},[{"t":"f","v":"is-good-enough"},{"t":"w","v":"g"},{"t":"w","v":"x"}],{"t":"w","v":"g"},[{"t":"f","v":"sqrt-iter"},[{"t":"f","v":"improve-guess"},{"t":"w","v":"g"},{"t":"w","v":"x"}],{"t":"w","v":"x"}]]]],[{"t":"f","v":"sqrt-iter"},{"t":"a","v":1},{"t":"w","v":"x"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"circumference"},[{"t":"f","v":"lambda"},{"t":"w","v":"radius"},[{"t":"f","v":"*"},{"t":"w","v":"PI"},[{"t":"f","v":"*"},{"t":"w","v":"radius"},{"t":"a","v":2}]]]],[{"t":"f","v":"let"},{"t":"w","v":"hypotenuse"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"sqrt"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"b"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"abs"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"-"},[{"t":"f","v":"^"},{"t":"w","v":"n"},[{"t":"f","v":">>"},{"t":"w","v":"n"},{"t":"a","v":31}]],[{"t":"f","v":">>"},{"t":"w","v":"n"},{"t":"a","v":31}]]]],[{"t":"f","v":"let"},{"t":"w","v":"nth-digit"},[{"t":"f","v":"lambda"},{"t":"w","v":"digit"},{"t":"w","v":"n"},[{"t":"f","v":"|"},[{"t":"f","v":"mod"},[{"t":"f","v":"/"},{"t":"w","v":"digit"},[{"t":"f","v":"power"},{"t":"a","v":10},[{"t":"f","v":"-"},{"t":"w","v":"n"},{"t":"a","v":1}]]],{"t":"a","v":10}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"normalize"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"value"},{"t":"w","v":"min"},{"t":"w","v":"max"},[{"t":"f","v":"*"},[{"t":"f","v":"-"},{"t":"w","v":"value"},{"t":"w","v":"min"}],[{"t":"f","v":"/"},[{"t":"f","v":"-"},{"t":"w","v":"max"},{"t":"w","v":"min"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"linear-interpolation"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},{"t":"w","v":"n"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},[{"t":"f","v":"-"},{"t":"a","v":1},{"t":"w","v":"n"}],{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"n"},{"t":"w","v":"b"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"gauss-sum"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"*"},{"t":"w","v":"n"},[{"t":"f","v":"+"},{"t":"w","v":"n"},{"t":"a","v":1}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"gauss-sum-sequance"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"a"},{"t":"w","v":"b"}],[{"t":"f","v":"+"},[{"t":"f","v":"-"},{"t":"w","v":"b"},{"t":"w","v":"a"}],{"t":"a","v":1}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"clamp"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"limit"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"x"},{"t":"w","v":"limit"}],{"t":"w","v":"limit"},{"t":"w","v":"x"}]]],[{"t":"f","v":"let"},{"t":"w","v":"odd?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"x"},{"t":"a","v":2}],{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"even?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"x"},{"t":"a","v":2}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"sign"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"n"},{"t":"a","v":0}],{"t":"a","v":-1},{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"radians"},[{"t":"f","v":"lambda"},{"t":"w","v":"deg"},[{"t":"f","v":"*"},{"t":"w","v":"deg"},{"t":"w","v":"PI"},[{"t":"f","v":"/"},{"t":"a","v":180}]]]],[{"t":"f","v":"let"},{"t":"w","v":"average"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"x"},{"t":"w","v":"y"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"x"},{"t":"w","v":"y"}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"euclidean-mod"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"mod"},[{"t":"f","v":"+"},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"w","v":"b"}],{"t":"w","v":"b"}]]],[{"t":"f","v":"let"},{"t":"w","v":"euclidean-distance"},[{"t":"f","v":"lambda"},{"t":"w","v":"x1"},{"t":"w","v":"y1"},{"t":"w","v":"x2"},{"t":"w","v":"y2"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"a"},[{"t":"f","v":"-"},{"t":"w","v":"x1"},{"t":"w","v":"x2"}]],[{"t":"f","v":"let"},{"t":"w","v":"b"},[{"t":"f","v":"-"},{"t":"w","v":"y1"},{"t":"w","v":"y2"}]],[{"t":"f","v":"sqrt"},[{"t":"f","v":"+"},[{"t":"f","v":"*"},{"t":"w","v":"a"},{"t":"w","v":"a"}],[{"t":"f","v":"*"},{"t":"w","v":"b"},{"t":"w","v":"b"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"manhattan-distance"},[{"t":"f","v":"lambda"},{"t":"w","v":"x1"},{"t":"w","v":"y1"},{"t":"w","v":"x2"},{"t":"w","v":"y2"},[{"t":"f","v":"+"},[{"t":"f","v":"abs"},[{"t":"f","v":"-"},{"t":"w","v":"x2"},{"t":"w","v":"x1"}]],[{"t":"f","v":"abs"},[{"t":"f","v":"-"},{"t":"w","v":"y2"},{"t":"w","v":"y1"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"positive?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":">"},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"negative?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":"<"},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"zero?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"num"},[{"t":"f","v":"="},{"t":"w","v":"num"},{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"divisible?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"a"},{"t":"w","v":"b"}],{"t":"a","v":0}]]],[{"t":"f","v":"let"},{"t":"w","v":"prime?"},[{"t":"f","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"cond"},[{"t":"f","v":"="},{"t":"w","v":"n"},{"t":"a","v":1}],{"t":"a","v":0},[{"t":"f","v":"<"},{"t":"w","v":"n"},{"t":"a","v":0}],{"t":"a","v":0},[{"t":"f","v":"*"}],[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iter"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"it-is"},[{"t":"f","v":"not"},[{"t":"f","v":"="},[{"t":"f","v":"mod"},{"t":"w","v":"n"},{"t":"w","v":"i"}],{"t":"a","v":0}]]],[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"<="},{"t":"w","v":"i"},{"t":"w","v":"end"}],{"t":"w","v":"it-is"}],[{"t":"f","v":"iter"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],{"t":"w","v":"end"}],{"t":"w","v":"it-is"}]]]],[{"t":"f","v":"or"},[{"t":"f","v":"="},{"t":"w","v":"n"},{"t":"a","v":2}],[{"t":"f","v":"iter"},{"t":"a","v":2},[{"t":"f","v":"sqrt"},{"t":"w","v":"n"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"slice"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"bounds"},[{"t":"f","v":"-"},{"t":"w","v":"end"},{"t":"w","v":"start"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"bounds"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"get"},{"t":"w","v":"array"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"w","v":"i"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"a","v":0},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"binary-search"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"target"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"search"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"target"},{"t":"w","v":"start"},{"t":"w","v":"end"},[{"t":"f","v":"do"},[{"t":"f","v":"when"},[{"t":"f","v":"<="},{"t":"w","v":"start"},{"t":"w","v":"end"}],[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"index"},[{"t":"f","v":"floor"},[{"t":"f","v":"*"},[{"t":"f","v":"+"},{"t":"w","v":"start"},{"t":"w","v":"end"}],{"t":"a","v":0.5}]]],[{"t":"f","v":"let"},{"t":"w","v":"current"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"index"}]],[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"target"},{"t":"w","v":"current"}],{"t":"w","v":"target"},[{"t":"f","v":"if"},[{"t":"f","v":">"},{"t":"w","v":"current"},{"t":"w","v":"target"}],[{"t":"f","v":"search"},{"t":"w","v":"arr"},{"t":"w","v":"target"},{"t":"w","v":"start"},[{"t":"f","v":"-"},{"t":"w","v":"index"},{"t":"a","v":1}]],[{"t":"f","v":"search"},{"t":"w","v":"arr"},{"t":"w","v":"target"},[{"t":"f","v":"+"},{"t":"w","v":"index"},{"t":"a","v":1}],{"t":"w","v":"end"}]]]]]]]],[{"t":"f","v":"search"},{"t":"w","v":"array"},{"t":"w","v":"target"},{"t":"a","v":0},[{"t":"f","v":"length"},{"t":"w","v":"array"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"zip"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"A"},{"t":"w","v":"B"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},{"t":"w","v":"output"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"a"}],[{"t":"f","v":"length"},{"t":"w","v":"b"}]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"a"}],[{"t":"f","v":"cdr"},{"t":"w","v":"b"}],[{"t":"f","v":"merge"},{"t":"w","v":"output"},[{"t":"f","v":"Array"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"a"}],[{"t":"f","v":"car"},{"t":"w","v":"b"}]]]]],{"t":"w","v":"output"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"A"},{"t":"w","v":"B"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"cartesian-product"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"fold"},{"t":"w","v":"a"},[{"t":"f","v":"lambda"},{"t":"w","v":"p"},{"t":"w","v":"x"},[{"t":"f","v":"merge"},{"t":"w","v":"p"},[{"t":"f","v":"scan"},{"t":"w","v":"b"},[{"t":"f","v":"lambda"},{"t":"w","v":"y"},[{"t":"f","v":"Array"},{"t":"w","v":"x"},{"t":"w","v":"y"}]]]]],[]]]],[{"t":"f","v":"let"},{"t":"w","v":"equal?"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"or"},[{"t":"f","v":"and"},[{"t":"f","v":"Atom?"},{"t":"w","v":"a"}],[{"t":"f","v":"Atom?"},{"t":"w","v":"b"}],[{"t":"f","v":"="},{"t":"w","v":"a"},{"t":"w","v":"b"}]],[{"t":"f","v":"and"},[{"t":"f","v":"Array?"},{"t":"w","v":"a"}],[{"t":"f","v":"="},[{"t":"f","v":"length"},{"t":"w","v":"a"}],[{"t":"f","v":"length"},{"t":"w","v":"b"}]],[{"t":"f","v":"not"},[{"t":"f","v":"some?"},[{"t":"f","v":"sequence"},{"t":"w","v":"a"}],[{"t":"f","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"not"},[{"t":"f","v":"equal?"},[{"t":"f","v":"get"},{"t":"w","v":"a"},{"t":"w","v":"i"}],[{"t":"f","v":"get"},{"t":"w","v":"b"},{"t":"w","v":"i"}]]]]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"split"},[{"t":"f","v":"lambda"},{"t":"w","v":"string"},{"t":"w","v":"delim"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"input"},[{"t":"f","v":"type"},[{"t":"f","v":"concatenate"},{"t":"w","v":"string"},{"t":"w","v":"delim"}],{"t":"w","v":"Array"}]],[{"t":"f","v":"let"},{"t":"w","v":"marks"},[{"t":"f","v":"go"},{"t":"w","v":"input"},[{"t":"f","v":"zip"},[{"t":"f","v":"sequence"},{"t":"w","v":"input"}]],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"if"},[{"t":"f","v":"="},[{"t":"f","v":"car"},{"t":"w","v":"x"}],{"t":"w","v":"delim"}],[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"x"}]],[{"t":"f","v":"car"},{"t":"w","v":"x"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"first"},[{"t":"f","v":"find"},{"t":"w","v":"marks"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"Number?"},{"t":"w","v":"x"}]]]],[{"t":"f","v":"go"},{"t":"w","v":"marks"},[{"t":"f","v":"fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":"Number?"},{"t":"w","v":"b"}],[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"Array"},[{"t":"f","v":"slice"},{"t":"w","v":"input"},[{"t":"f","v":"-"},{"t":"w","v":"b"},{"t":"w","v":"first"}],{"t":"w","v":"b"}]]],{"t":"w","v":"a"}]],[]],[{"t":"f","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"array->string"},{"t":"w","v":"x"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"join"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"delim"},[{"t":"f","v":"fold"},[{"t":"f","v":"zip"},{"t":"w","v":"array"},[{"t":"f","v":"sequence"},{"t":"w","v":"array"}]],[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"if"},[{"t":"f","v":">"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"b"}]],{"t":"a","v":0}],[{"t":"f","v":"concatenate"},{"t":"w","v":"a"},{"t":"w","v":"delim"},[{"t":"f","v":"type"},[{"t":"f","v":"car"},{"t":"w","v":"b"}],{"t":"w","v":"String"}]],[{"t":"f","v":"type"},[{"t":"f","v":"car"},{"t":"w","v":"b"}],{"t":"w","v":"String"}]]],{"t":"a","v":""}]]],[{"t":"f","v":"let"},{"t":"w","v":"flat"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"flatten"},[{"t":"f","v":"lambda"},{"t":"w","v":"item"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"Array?"},{"t":"w","v":"item"}],[{"t":"f","v":"length"},{"t":"w","v":"item"}]],[{"t":"f","v":"fold"},{"t":"w","v":"item"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"flatten"},{"t":"w","v":"b"}]]],[]],[{"t":"f","v":"Array"},{"t":"w","v":"item"}]]]],[{"t":"f","v":"flatten"},{"t":"w","v":"array"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"sort"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"if"},[{"t":"f","v":"<="},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"a","v":1}],{"t":"w","v":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"pivot"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"bounds"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"current"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"i"}]],[{"t":"f","v":"let"},{"t":"w","v":"predicate"},[{"t":"f","v":"callback"},{"t":"w","v":"current"},{"t":"w","v":"pivot"}]],[{"t":"f","v":"let"},{"t":"w","v":"left"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"predicate"},{"t":"a","v":0}],[{"t":"f","v":"merge"},{"t":"w","v":"a"},[{"t":"f","v":"Array"},{"t":"w","v":"current"}]],{"t":"w","v":"a"}]],[{"t":"f","v":"let"},{"t":"w","v":"right"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"predicate"},{"t":"a","v":1}],[{"t":"f","v":"merge"},{"t":"w","v":"b"},[{"t":"f","v":"Array"},{"t":"w","v":"current"}]],{"t":"w","v":"b"}]],[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"bounds"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],{"t":"w","v":"bounds"},{"t":"w","v":"left"},{"t":"w","v":"right"}],[{"t":"f","v":"Array"},{"t":"w","v":"left"},{"t":"w","v":"right"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"iterate"},{"t":"a","v":1},[{"t":"f","v":"-"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"a","v":1}],[],[]]],[{"t":"f","v":"let"},{"t":"w","v":"left"},[{"t":"f","v":"car"},{"t":"w","v":"sorted"}]],[{"t":"f","v":"let"},{"t":"w","v":"right"},[{"t":"f","v":"car"},[{"t":"f","v":"cdr"},{"t":"w","v":"sorted"}]]],[{"t":"f","v":"merge"},[{"t":"f","v":"sort"},{"t":"w","v":"left"},{"t":"w","v":"callback"}],[{"t":"f","v":"Array"},{"t":"w","v":"pivot"}],[{"t":"f","v":"sort"},{"t":"w","v":"right"},{"t":"w","v":"callback"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"set"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"i"},{"t":"w","v":"value"},[{"t":"f","v":"if"},[{"t":"f","v":"array-in-bounds?"},{"t":"w","v":"array"},{"t":"w","v":"i"}],[{"t":"f","v":"scan"},[{"t":"f","v":"sequence"},{"t":"w","v":"array"}],[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"if"},[{"t":"f","v":"="},{"t":"w","v":"x"},{"t":"w","v":"i"}],{"t":"w","v":"value"},[{"t":"f","v":"get"},{"t":"w","v":"array"},{"t":"w","v":"x"}]]]],[{"t":"f","v":"throw"},[{"t":"f","v":"concatenate"},[{"t":"f","v":"type"},{"t":"w","v":"i"},{"t":"w","v":"String"}],{"t":"a","v":" is outside of the array bounds."}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"adjacent-difference"},[{"t":"f","v":"lambda"},{"t":"w","v":"array"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"len"},[{"t":"f","v":"length"},{"t":"w","v":"array"}]],[{"t":"f","v":"unless"},[{"t":"f","v":"="},{"t":"w","v":"len"},{"t":"a","v":1}],[{"t":"f","v":"do"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"array"}]],[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"i"},{"t":"w","v":"result"},[{"t":"f","v":"if"},[{"t":"f","v":"<"},{"t":"w","v":"i"},{"t":"w","v":"len"}],[{"t":"f","v":"do"},[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],[{"t":"f","v":"set"},{"t":"w","v":"result"},{"t":"w","v":"i"},[{"t":"f","v":"callback"},[{"t":"f","v":"get"},{"t":"w","v":"array"},[{"t":"f","v":"-"},{"t":"w","v":"i"},{"t":"a","v":1}]],[{"t":"f","v":"get"},{"t":"w","v":"array"},{"t":"w","v":"i"}]]]]],{"t":"w","v":"result"}]]],[{"t":"f","v":"iterate"},{"t":"a","v":1},{"t":"w","v":"array"}]],{"t":"w","v":"array"}]]]]]
|
package/package.json
CHANGED
package/src/interpreter.js
CHANGED
@@ -14,8 +14,14 @@ export const evaluate = (expression, env) => {
|
|
14
14
|
}
|
15
15
|
case APPLY:
|
16
16
|
const apply = env[first[VALUE]]
|
17
|
+
if (apply == undefined)
|
18
|
+
throw new ReferenceError(
|
19
|
+
`Undefined (${KEYWORDS.ANONYMOUS_FUNCTION}) ${first[VALUE]}.`
|
20
|
+
)
|
17
21
|
if (typeof apply !== 'function')
|
18
|
-
throw new TypeError(
|
22
|
+
throw new TypeError(
|
23
|
+
`${first[VALUE]} is not a (${KEYWORDS.ANONYMOUS_FUNCTION}).`
|
24
|
+
)
|
19
25
|
return apply(rest, env)
|
20
26
|
case ATOM:
|
21
27
|
return first[VALUE]
|
package/src/utils.js
CHANGED
@@ -155,19 +155,34 @@ export const handleUnbalancedQuotes = (source) => {
|
|
155
155
|
if (diff !== 0) throw new SyntaxError(`Quotes are unbalanced "`)
|
156
156
|
return source
|
157
157
|
}
|
158
|
+
|
158
159
|
export const treeShake = (ast, libs) => {
|
159
160
|
const deps = libs.reduce((a, x) => a.add(x.at(1)[VALUE]), new Set())
|
160
|
-
const visited = new
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
161
|
+
const visited = new Set()
|
162
|
+
|
163
|
+
const dfs = (tree) => {
|
164
|
+
if (Array.isArray(tree)) {
|
165
|
+
tree.forEach((a) => dfs(a))
|
166
|
+
} else if (
|
167
|
+
(tree[TYPE] === APPLY || tree[TYPE] === WORD) &&
|
168
|
+
deps.has(tree[VALUE]) &&
|
169
|
+
!visited.has(tree[VALUE])
|
170
|
+
) {
|
171
|
+
visited.add(tree[VALUE])
|
172
|
+
// Recursively explore the dependencies of the current node
|
173
|
+
const dependencyLib = libs.find((x) => x.at(1)[VALUE] === tree[VALUE])
|
174
|
+
if (dependencyLib) {
|
175
|
+
dfs(dependencyLib.at(-1))
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
167
180
|
dfs(ast)
|
168
|
-
|
181
|
+
|
182
|
+
// Filter out libraries that are not in the visited set
|
169
183
|
return libs.filter((x) => visited.has(x.at(1)[VALUE]))
|
170
184
|
}
|
185
|
+
|
171
186
|
export const runFromCompiled = (source) => {
|
172
187
|
const tree = parse(
|
173
188
|
handleUnbalancedQuotes(handleUnbalancedParens(removeNoCode(source)))
|
package/lib/src/std.lisp
DELETED
@@ -1,275 +0,0 @@
|
|
1
|
-
(let E 2.718281828459045)
|
2
|
-
(let PI 3.141592653589793)
|
3
|
-
|
4
|
-
(let* iteration (lambda array callback
|
5
|
-
(when (length array)
|
6
|
-
(do (callback (car array))
|
7
|
-
(iteration (cdr array) callback)))))
|
8
|
-
|
9
|
-
(let scan (lambda array callback (do
|
10
|
-
(let* iterate (lambda array out
|
11
|
-
(if (length array)
|
12
|
-
(iterate (cdr array)
|
13
|
-
(merge out (Array (callback (car array)))))
|
14
|
-
out)))
|
15
|
-
(iterate array ()))))
|
16
|
-
|
17
|
-
(let select (lambda array callback (do
|
18
|
-
(let* iterate (lambda array out
|
19
|
-
(if (length array)
|
20
|
-
(iterate (cdr array)
|
21
|
-
(if (callback (car array))
|
22
|
-
(merge out (Array (car array)))
|
23
|
-
out))
|
24
|
-
out)))
|
25
|
-
(iterate array ()))))
|
26
|
-
|
27
|
-
(let exclude (lambda array callback (do
|
28
|
-
(let* iterate (lambda array out
|
29
|
-
(if (length array)
|
30
|
-
(iterate (cdr array)
|
31
|
-
(if (not (callback (car array)))
|
32
|
-
(merge out (Array (car array)))
|
33
|
-
out))
|
34
|
-
out)))
|
35
|
-
(iterate array ()))))
|
36
|
-
|
37
|
-
(let fold (lambda array callback initial (do
|
38
|
-
(let* iterate (lambda array out
|
39
|
-
(if (length array)
|
40
|
-
(iterate (cdr array) (callback out (car array)))
|
41
|
-
out)))
|
42
|
-
(iterate array initial))))
|
43
|
-
|
44
|
-
(let every? (lambda array callback (do
|
45
|
-
(let* iterate (lambda array
|
46
|
-
(if (and (length array) (callback (car array)))
|
47
|
-
(iterate (cdr array))
|
48
|
-
(not (length array)))))
|
49
|
-
(iterate array))))
|
50
|
-
|
51
|
-
(let some? (lambda array callback (do
|
52
|
-
(let* iterate (lambda array
|
53
|
-
(if (and (length array) (not (callback (car array))))
|
54
|
-
(iterate (cdr array))
|
55
|
-
(type (length array) Boolean))))
|
56
|
-
(iterate array))))
|
57
|
-
|
58
|
-
(let find (lambda array callback (do
|
59
|
-
(let* iterate (lambda array
|
60
|
-
(when (length array)
|
61
|
-
(if (callback (car array)) (car array) (iterate (cdr array))))))
|
62
|
-
(iterate array))))
|
63
|
-
|
64
|
-
(let has? (lambda array callback (do
|
65
|
-
(let* iterate (lambda array
|
66
|
-
(when (length array)
|
67
|
-
(if (callback (car array)) 1 (iterate (cdr array))))))
|
68
|
-
(iterate array))))
|
69
|
-
|
70
|
-
(let reverse (lambda array (do
|
71
|
-
(let* iterate (lambda array out
|
72
|
-
(if (length array)
|
73
|
-
(iterate (cdr array)
|
74
|
-
(merge (Array (car array)) out))
|
75
|
-
out)))
|
76
|
-
(iterate array ()))))
|
77
|
-
|
78
|
-
(let range (lambda start end (do
|
79
|
-
(let* iterate (lambda out count
|
80
|
-
(if (<= count end) (iterate (merge out (Array count)) (+ count 1)) out)))
|
81
|
-
(iterate () start))))
|
82
|
-
|
83
|
-
(let sequence (lambda array (do
|
84
|
-
(let end (length array))
|
85
|
-
(let* iterate (lambda out count
|
86
|
-
(if (< (length out) end) (iterate (merge out (Array count)) (+ count 1)) out)))
|
87
|
-
(iterate () 0))))
|
88
|
-
|
89
|
-
(let sequence-n (lambda n (do
|
90
|
-
(let* iterate (lambda out count
|
91
|
-
(if (< (length out) n) (iterate (merge out (Array count)) (+ count 1)) out)))
|
92
|
-
(iterate () 0))))
|
93
|
-
|
94
|
-
(let unique (lambda array (go
|
95
|
-
(let sorted (sort array (safety lambda a b (> a b))))
|
96
|
-
(zip (sequence sorted))
|
97
|
-
(select (lambda x
|
98
|
-
(or (not (let index (car (cdr x))))
|
99
|
-
(not (= (get sorted (- index 1)) (get sorted index))))))
|
100
|
-
(scan car))))
|
101
|
-
|
102
|
-
(let for-range (lambda start end callback (do
|
103
|
-
(let* iterate (lambda i
|
104
|
-
(when (< i end)
|
105
|
-
(do
|
106
|
-
(callback i)
|
107
|
-
(iterate (+ i 1))))))
|
108
|
-
(iterate start))))
|
109
|
-
|
110
|
-
(let list-range (lambda start end (do
|
111
|
-
(let range (lambda list start end
|
112
|
-
(if (< start end)
|
113
|
-
(Array (merge list (range (Array (Array (+ start 1))) (+ start 1) end)))
|
114
|
-
list)))
|
115
|
-
(car (car (range () start end))))))
|
116
|
-
|
117
|
-
(let traverse (lambda x callback
|
118
|
-
(if (Atom? x)
|
119
|
-
(callback x)
|
120
|
-
(iterate x (lambda y (traverse y callback))))))
|
121
|
-
|
122
|
-
(let summation (lambda array (fold array (safety lambda a b (+ a b)) 0)))
|
123
|
-
(let product (lambda array (fold array (safety lambda a b (* a b)) 1)))
|
124
|
-
(let maximum (lambda array (fold array (safety lambda a b (if (> a b) a b)) (car array))))
|
125
|
-
(let minimum (lambda array (fold array (safety lambda a b (if (< a b) a b)) (car array))))
|
126
|
-
(let max (lambda a b (if (> a b) a b)))
|
127
|
-
(let min (lambda a b (if (< a b) a b)))
|
128
|
-
(let count-of (lambda array callback (go array (select callback) (length))))
|
129
|
-
(let increment (safety lambda i (+ i 1)))
|
130
|
-
(let floor (safety lambda n (| n 0)))
|
131
|
-
(let round (safety lambda n (| (+ n 0.5) 0)))
|
132
|
-
(let empty? (safety lambda array (not (length array))))
|
133
|
-
(let array-in-bounds? (safety lambda array index (and (< index (length array)) (>= index 0))))
|
134
|
-
|
135
|
-
(let string->array (safety lambda string (type string Array)))
|
136
|
-
(let array->string (lambda array (fold array (safety lambda a x (concatenate a (type x String))) "")))
|
137
|
-
(let string->number (safety lambda string (type string Number)))
|
138
|
-
(let number->string (safety lambda number (type number String)))
|
139
|
-
(let strings->numbers (lambda array (scan array (safety lambda x (type x Number)))))
|
140
|
-
(let numbers->strings (lambda array (scan array (safety lambda x (type x String)))))
|
141
|
-
(let string->charcodes (lambda string (go string (type Array) (scan (lambda x (type x Char-Code))))))
|
142
|
-
(let chars->charcodes (lambda array (go array (scan (lambda x (type x Char-Code))))))
|
143
|
-
(let charcodes->chars (lambda array (go array (scan (lambda x (type x Char))))))
|
144
|
-
(let charcodes->string (lambda array (go array (scan (lambda x (type x Char))) (array->string))))
|
145
|
-
|
146
|
-
(let power (lambda base exp
|
147
|
-
(if (< exp 0)
|
148
|
-
(if (= base 0)
|
149
|
-
(throw "Attempting to divide by 0 in (power)")
|
150
|
-
(/ (* base (power base (- (* exp -1) 1)))))
|
151
|
-
(cond
|
152
|
-
(= exp 0) 1
|
153
|
-
(= exp 1) base
|
154
|
-
(*) (* base (power base (- exp 1)))))))
|
155
|
-
|
156
|
-
(let greatest-common-divisor (lambda a b (do
|
157
|
-
(let* gcd (lambda a b
|
158
|
-
(if (= b 0) a (gcd b (mod a b)))) (gcd a b)))))
|
159
|
-
|
160
|
-
(let least-common-divisor (lambda a b (* a b (/ (greatest-common-divisor a b)))))
|
161
|
-
|
162
|
-
(let sqrt (lambda x (do
|
163
|
-
(let is-good-enough (lambda g x (< (abs (- (square g) x)) 0.01))
|
164
|
-
improve-guess (lambda g x (average g (* x (/ g)))))
|
165
|
-
(let* sqrt-iter (lambda g x
|
166
|
-
(if (is-good-enough g x) g
|
167
|
-
(sqrt-iter (improve-guess g x) x))))
|
168
|
-
(sqrt-iter 1.0 x))))
|
169
|
-
(let circumference (lambda radius (* PI (* radius 2))))
|
170
|
-
(let hypotenuse (lambda a b (sqrt (+ (* a a) (* b b)))))
|
171
|
-
(let abs (safety lambda n (- (^ n (>> n 31)) (>> n 31))))
|
172
|
-
(let nth-digit (lambda digit n (| (mod (/ digit (power 10 (- n 1))) 10) 0.5)))
|
173
|
-
(let normalize (safety lambda value min max (* (- value min) (/ (- max min)))))
|
174
|
-
(let linear-interpolation (safety lambda a b n (+ (* (- 1 n) a) (* n b))))
|
175
|
-
(let gauss-sum (safety lambda n (* n (+ n 1) 0.5)))
|
176
|
-
(let gauss-sum-sequance (safety lambda a b (* (+ a b) (+ (- b a) 1) 0.5)))
|
177
|
-
(let clamp (safety lambda x limit (if (> x limit) limit x)))
|
178
|
-
(let odd? (safety lambda x (= (mod x 2) 1)))
|
179
|
-
(let even? (safety lambda x (= (mod x 2) 0)))
|
180
|
-
(let sign (safety lambda n (if (< n 0) -1 1)))
|
181
|
-
(let radians (lambda deg (* deg PI (/ 180))))
|
182
|
-
(let average (safety lambda x y (* (+ x y) 0.5)))
|
183
|
-
(let euclidean-mod (safety lambda a b (mod (+ (mod a b) b) b)))
|
184
|
-
(let euclidean-distance (lambda x1 y1 x2 y2 (do
|
185
|
-
(let a (- x1 x2))
|
186
|
-
(let b (- y1 y2))
|
187
|
-
(sqrt (+ (* a a) (* b b))))))
|
188
|
-
(let manhattan-distance (lambda x1 y1 x2 y2 (+ (abs (- x2 x1)) (abs (- y2 y1)))))
|
189
|
-
(let positive? (safety lambda num (> num 0)))
|
190
|
-
(let negative? (safety lambda num (< num 0)))
|
191
|
-
(let zero? (safety lambda num (= num 0)))
|
192
|
-
(let divisible? (safety lambda a b (= (mod a b) 0)))
|
193
|
-
(let prime? (lambda n
|
194
|
-
(cond
|
195
|
-
(= n 1) 0
|
196
|
-
(< n 0) 0
|
197
|
-
(*) (do
|
198
|
-
(let* iter (lambda i end (do
|
199
|
-
(let it-is (not (= (mod n i) 0)))
|
200
|
-
(if (and (<= i end) it-is) (iter (+ i 1) end) it-is))))
|
201
|
-
(or (= n 2) (iter 2 (sqrt n)))))))
|
202
|
-
|
203
|
-
(let slice (safety lambda array start end (do
|
204
|
-
(let bounds (- end start))
|
205
|
-
(let* iterate (lambda i out
|
206
|
-
(if (< i bounds)
|
207
|
-
(iterate (+ i 1) (merge out (Array (get array (+ start i)))))
|
208
|
-
out)))
|
209
|
-
(iterate 0 ()))))
|
210
|
-
|
211
|
-
(let binary-search
|
212
|
-
(lambda array target (do
|
213
|
-
(let* search
|
214
|
-
(lambda arr target start end (do
|
215
|
-
(when (<= start end) (do
|
216
|
-
(let index (floor (* (+ start end) 0.5)))
|
217
|
-
(let current (get arr index))
|
218
|
-
(if (= target current) target
|
219
|
-
(if (> current target)
|
220
|
-
(search arr target start (- index 1))
|
221
|
-
(search arr target (+ index 1) end))))))))
|
222
|
-
(search array target 0 (length array)))))
|
223
|
-
|
224
|
-
(let zip (safety lambda A B (do
|
225
|
-
(let* iterate (lambda a b output
|
226
|
-
(if (and (length a) (length b)) (iterate (cdr a) (cdr b) (merge output (Array (Array (car a) (car b))))) output)))
|
227
|
-
(iterate A B ()))))
|
228
|
-
|
229
|
-
(let cartesian-product (lambda a b (fold a (lambda p x (merge p (scan b (lambda y (Array x y))))) ())))
|
230
|
-
|
231
|
-
(let equal? (lambda a b
|
232
|
-
(or (and (Atom? a) (Atom? b) (= a b))
|
233
|
-
(and (Array? a)
|
234
|
-
(= (length a) (length b))
|
235
|
-
(not (some? (sequence a) (lambda i (not (equal? (get a i) (get b i))))))))))
|
236
|
-
|
237
|
-
(let split (lambda string delim (do
|
238
|
-
(let input (type (concatenate string delim) Array))
|
239
|
-
(let marks
|
240
|
-
(go
|
241
|
-
input
|
242
|
-
(zip (sequence input))
|
243
|
-
(scan (lambda x (if (= (car x) delim) (car (cdr x)) (car x))))))
|
244
|
-
(let first (find marks (lambda x (Number? x))))
|
245
|
-
(go
|
246
|
-
marks
|
247
|
-
(fold (lambda a b
|
248
|
-
(if (Number? b)
|
249
|
-
(merge a (Array (slice input (- b first) b)))
|
250
|
-
a)) ())
|
251
|
-
(scan (lambda x (array->string x)))))))
|
252
|
-
|
253
|
-
(let join (lambda array delim (fold (zip array (sequence array)) (lambda a b (if (> (car (cdr b)) 0) (concatenate a delim (type (car b) String)) (type (car b) String))) "")))
|
254
|
-
|
255
|
-
(let flat (lambda array (do
|
256
|
-
(let flatten (lambda item
|
257
|
-
(if (and (Array? item) (length item))
|
258
|
-
(fold item (lambda a b (merge a (flatten b))) ())
|
259
|
-
(Array item))))
|
260
|
-
(flatten array))))
|
261
|
-
|
262
|
-
(let sort (lambda arr callback (do
|
263
|
-
(if (<= (length arr) 1) arr (do
|
264
|
-
(let pivot (car arr))
|
265
|
-
(let* iterate (lambda i bounds a b (do
|
266
|
-
(let current (get arr i))
|
267
|
-
(let predicate (callback current pivot))
|
268
|
-
(let left (if (= predicate 0) (merge a (Array current)) a))
|
269
|
-
(let right (if (= predicate 1) (merge b (Array current)) b))
|
270
|
-
(if (< i bounds) (iterate (+ i 1) bounds left right)
|
271
|
-
(Array left right)))))
|
272
|
-
(let sorted (iterate 1 (- (length arr) 1) () ()))
|
273
|
-
(let left (car sorted))
|
274
|
-
(let right (car (cdr sorted)))
|
275
|
-
(merge (sort left callback) (Array pivot) (sort right callback)))))))
|