fez-lisp 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/cli/index.js +162 -0
- package/index.js +8 -0
- package/js.svg +14 -0
- package/lib/baked/std.js +1 -0
- package/lib/src/std.lisp +275 -0
- package/logo.svg +8 -0
- package/package.json +33 -0
- package/src/compiler.js +361 -0
- package/src/enums.js +79 -0
- package/src/interpreter.js +29 -0
- package/src/parser.js +45 -0
- package/src/tokeniser.js +1036 -0
- package/src/utils.js +258 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 AT-290690
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# fez
|
2
|
+
|
3
|
+
<p align="center">
|
4
|
+
<img width="64" src="./logo.svg"/>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
```lisp
|
8
|
+
(let fizz-buzz (lambda n
|
9
|
+
(cond
|
10
|
+
(= (mod n 15) 0) "Fizz Buzz"
|
11
|
+
(= (mod n 3) 0) "Fizz"
|
12
|
+
(= (mod n 5) 0) "Buzz"
|
13
|
+
(*) n)))
|
14
|
+
|
15
|
+
(go (range 1 100) (scan fizz-buzz) (log!))
|
16
|
+
```
|
17
|
+
|
18
|
+
```lisp
|
19
|
+
; https://adventofcode.com/2020/day/1
|
20
|
+
(let *input*
|
21
|
+
"1721
|
22
|
+
979
|
23
|
+
366
|
24
|
+
299
|
25
|
+
675
|
26
|
+
1456")
|
27
|
+
; solve part 1
|
28
|
+
(let solve (lambda array cb
|
29
|
+
(fold array (lambda a b (do
|
30
|
+
(let res (binary-search array (cb b)))
|
31
|
+
(if res (merge a (Array res)) a)))
|
32
|
+
())))
|
33
|
+
; 514579
|
34
|
+
(go *input*
|
35
|
+
(split "\n")
|
36
|
+
(strings->numbers)
|
37
|
+
(sort (lambda a b (> a b)))
|
38
|
+
(solve (lambda x (- 2020 x)))
|
39
|
+
(product)
|
40
|
+
(log!))
|
41
|
+
```
|
42
|
+
|
43
|
+
```lisp
|
44
|
+
; https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/description/
|
45
|
+
(let max-count-of (lambda nums
|
46
|
+
(max
|
47
|
+
(count-of nums positive?)
|
48
|
+
(count-of nums negative?))))
|
49
|
+
|
50
|
+
(go
|
51
|
+
(Array -2 -1 -1 0 0 1 2)
|
52
|
+
(max-count-of)
|
53
|
+
(log!)) ; 3
|
54
|
+
```
|
55
|
+
|
56
|
+
```lisp
|
57
|
+
; remove duplicate elements in the array
|
58
|
+
(let unique (lambda array (go
|
59
|
+
(let sorted (sort array (safety lambda a b (> a b))))
|
60
|
+
(zip (sequence sorted))
|
61
|
+
(select (lambda x
|
62
|
+
(or (not (let index (car (cdr x))))
|
63
|
+
(not (= (get sorted (- index 1)) (get sorted index))))))
|
64
|
+
(scan car))))
|
65
|
+
; tests
|
66
|
+
(assert
|
67
|
+
(case "test 1" (unique (Array 1)) (Array 1))
|
68
|
+
(case "test 2" (unique (Array 1 2 2 4 5 9 5 12 14 1)) (Array 1 2 4 5 9 12 14)))
|
69
|
+
```
|
70
|
+
|
71
|
+
<p align="center">
|
72
|
+
<img width="64" src="./js.svg"/>
|
73
|
+
</p>
|
74
|
+
|
75
|
+
```js
|
76
|
+
import { fez } from '../index.js'
|
77
|
+
fez(`(log! "Hello World!")`)
|
78
|
+
```
|
79
|
+
|
80
|
+
```js
|
81
|
+
import { fez } from '../index.js'
|
82
|
+
fez(`(+ 1 "2")`, { errors: true })
|
83
|
+
```
|
84
|
+
|
85
|
+
```js
|
86
|
+
import { fez } from '../index.js'
|
87
|
+
eval(
|
88
|
+
fez(
|
89
|
+
`(go
|
90
|
+
(range 1 11)
|
91
|
+
(scan (lambda x (* x x)))
|
92
|
+
(log!)))`,
|
93
|
+
// include standard library
|
94
|
+
// compile fez to JavaScript
|
95
|
+
// tree shake standard library
|
96
|
+
{ std: true, compile: true, shake: true }
|
97
|
+
)
|
98
|
+
)
|
99
|
+
```
|
100
|
+
```js
|
101
|
+
import { fez } from '../index.js'
|
102
|
+
fez(`(let fizz-buzz (lambda n
|
103
|
+
(cond
|
104
|
+
(= (mod n 15) 0) "Fizz Buzz"
|
105
|
+
(= (mod n 3) 0) "Fizz"
|
106
|
+
(= (mod n 5) 0) "Buzz"
|
107
|
+
(*) n)))
|
108
|
+
|
109
|
+
(go (range 1 100) (scan fizz-buzz) (log!))`,
|
110
|
+
{ std: true, errors: true, compile: false, shake: true })
|
111
|
+
```
|
package/cli/index.js
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
import { readFileSync, writeFileSync } from 'fs'
|
2
|
+
import { start } from 'repl'
|
3
|
+
import { run } from '../src/interpreter.js'
|
4
|
+
import { parse } from '../src/parser.js'
|
5
|
+
import STD from '../lib/baked/std.js'
|
6
|
+
|
7
|
+
// import wabt from 'wabt'
|
8
|
+
import {
|
9
|
+
handleUnbalancedParens,
|
10
|
+
handleUnbalancedQuotes,
|
11
|
+
logError,
|
12
|
+
removeNoCode,
|
13
|
+
treeShake,
|
14
|
+
} from '../src/utils.js'
|
15
|
+
import { comp } from '../src/compiler.js'
|
16
|
+
export default async () => {
|
17
|
+
const [, , ...argv] = process.argv
|
18
|
+
let file = '',
|
19
|
+
path = '',
|
20
|
+
env = {},
|
21
|
+
destination = undefined
|
22
|
+
while (argv.length) {
|
23
|
+
const flag = argv.shift()?.toLowerCase()
|
24
|
+
const value = argv.shift()
|
25
|
+
if (!flag) throw new Error('No flag provided')
|
26
|
+
switch (flag) {
|
27
|
+
case '-m':
|
28
|
+
writeFileSync(path, removeNoCode(file), 'utf-8')
|
29
|
+
break
|
30
|
+
case '-d':
|
31
|
+
destination = value
|
32
|
+
break
|
33
|
+
case '-s':
|
34
|
+
path = value
|
35
|
+
file = readFileSync(value, 'utf-8')
|
36
|
+
break
|
37
|
+
case '-r':
|
38
|
+
try {
|
39
|
+
run(
|
40
|
+
parse(
|
41
|
+
handleUnbalancedQuotes(handleUnbalancedParens(removeNoCode(file)))
|
42
|
+
),
|
43
|
+
env
|
44
|
+
)
|
45
|
+
} catch (err) {
|
46
|
+
logError('Error')
|
47
|
+
logError(err.message)
|
48
|
+
}
|
49
|
+
break
|
50
|
+
case '-c':
|
51
|
+
{
|
52
|
+
const parsed = parse(
|
53
|
+
handleUnbalancedQuotes(handleUnbalancedParens(removeNoCode(file)))
|
54
|
+
)
|
55
|
+
const tree = [...treeShake(parsed, STD), ...parsed]
|
56
|
+
if (Array.isArray(tree)) {
|
57
|
+
const { top, program } = comp(tree)
|
58
|
+
const JavaScript = `${top}${program}`
|
59
|
+
writeFileSync(
|
60
|
+
destination ?? './playground/dist/main.js',
|
61
|
+
JavaScript
|
62
|
+
)
|
63
|
+
}
|
64
|
+
}
|
65
|
+
break
|
66
|
+
case '-r':
|
67
|
+
try {
|
68
|
+
const parsed = parse(
|
69
|
+
handleUnbalancedQuotes(handleUnbalancedParens(removeNoCode(file)))
|
70
|
+
)
|
71
|
+
run([...treeShake(parsed, STD), ...parsed], env)
|
72
|
+
} catch (err) {
|
73
|
+
logError('Error')
|
74
|
+
logError(err.message)
|
75
|
+
}
|
76
|
+
break
|
77
|
+
case '-repl':
|
78
|
+
{
|
79
|
+
let source = ''
|
80
|
+
const inpColor = '\x1b[32m'
|
81
|
+
const outColor = '\x1b[33m'
|
82
|
+
const errColor = '\x1b[31m'
|
83
|
+
console.log(inpColor)
|
84
|
+
start({
|
85
|
+
prompt: '',
|
86
|
+
eval: (input) => {
|
87
|
+
input = input.trim()
|
88
|
+
if (!input || input[0] === ';') return
|
89
|
+
try {
|
90
|
+
let out = `${source}\n${file}\n(do ${input})`
|
91
|
+
const parsed = parse(
|
92
|
+
handleUnbalancedQuotes(
|
93
|
+
handleUnbalancedParens(removeNoCode(out))
|
94
|
+
)
|
95
|
+
)
|
96
|
+
const result = run([...treeShake(parsed, STD), ...parsed], env)
|
97
|
+
if (typeof result === 'function') {
|
98
|
+
console.log(inpColor, `(λ)`)
|
99
|
+
} else if (Array.isArray(result)) {
|
100
|
+
console.log(
|
101
|
+
outColor,
|
102
|
+
JSON.stringify(result, (_, value) => {
|
103
|
+
switch (typeof value) {
|
104
|
+
case 'bigint':
|
105
|
+
return Number(value)
|
106
|
+
case 'function':
|
107
|
+
return 'λ'
|
108
|
+
case 'undefined':
|
109
|
+
case 'symbol':
|
110
|
+
return 0
|
111
|
+
case 'boolean':
|
112
|
+
return +value
|
113
|
+
default:
|
114
|
+
return value
|
115
|
+
}
|
116
|
+
})
|
117
|
+
.replace(new RegExp(/\[/g), '(')
|
118
|
+
.replace(new RegExp(/\]/g), ')')
|
119
|
+
.replace(new RegExp(/\,/g), ' ')
|
120
|
+
.replace(new RegExp(/"λ"/g), 'λ'),
|
121
|
+
inpColor
|
122
|
+
)
|
123
|
+
} else if (typeof result === 'string') {
|
124
|
+
console.log(outColor, `"${result}"`, inpColor)
|
125
|
+
} else if (result == undefined) {
|
126
|
+
console.log(errColor, '(void)', inpColor)
|
127
|
+
} else {
|
128
|
+
console.log(outColor, result, inpColor)
|
129
|
+
}
|
130
|
+
source = out
|
131
|
+
} catch (err) {
|
132
|
+
console.log(errColor, err.message, inpColor)
|
133
|
+
}
|
134
|
+
},
|
135
|
+
})
|
136
|
+
}
|
137
|
+
break
|
138
|
+
case '-help':
|
139
|
+
case '-h':
|
140
|
+
default:
|
141
|
+
console.log(`
|
142
|
+
-------------------------------------
|
143
|
+
-help
|
144
|
+
-------------------------------------
|
145
|
+
-s prepare a file
|
146
|
+
-------------------------------------
|
147
|
+
-d file to compile js
|
148
|
+
-------------------------------------
|
149
|
+
-c compile to js
|
150
|
+
-------------------------------------
|
151
|
+
-r interpret & run
|
152
|
+
-------------------------------------
|
153
|
+
-p interpret & run with 0 deps
|
154
|
+
-------------------------------------
|
155
|
+
-m minify code
|
156
|
+
-------------------------------------
|
157
|
+
-repl start Read Eval Print Loop
|
158
|
+
-------------------------------------
|
159
|
+
`)
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
package/index.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import { evaluate } from './src/interpreter.js'
|
2
|
+
import { parse } from './src/parser.js'
|
3
|
+
import { fez } from './src/utils.js'
|
4
|
+
import std from './lib/baked/std.js'
|
5
|
+
import { keywords } from './src/tokeniser.js'
|
6
|
+
import { WORD, APPLY, ATOM, VALUE, TYPE } from './src/enums.js'
|
7
|
+
const types = { WORD, APPLY, ATOM, VALUE, TYPE }
|
8
|
+
export { fez, parse, keywords, evaluate, std, types }
|
package/js.svg
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<svg width="144" height="128" viewBox="0 0 144 128" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M128 0H0V128H128V0Z" fill="#B44637"/>
|
3
|
+
<path d="M128 0H0V128H128V0Z" fill="#B44637"/>
|
4
|
+
<path d="M128 0H96V128H128V0Z" fill="#8E2F22"/>
|
5
|
+
<path d="M128 0H96V128H128V0Z" fill="#8E2F22"/>
|
6
|
+
<path d="M112 0H128V64H112V0Z" fill="#D6C096"/>
|
7
|
+
<path d="M24 56H40V120H24V56Z" fill="#D6C096"/>
|
8
|
+
<path d="M128 64H144V80H128V64Z" fill="#D6C096"/>
|
9
|
+
<path d="M8 104H24V120H8V104Z" fill="#D6C096"/>
|
10
|
+
<path d="M64 56H80V72H64V56Z" fill="#D6C096"/>
|
11
|
+
<path d="M48 56H64V88H48V56Z" fill="#D6C096"/>
|
12
|
+
<path d="M64 88H80V120H64V88Z" fill="#D6C096"/>
|
13
|
+
<path d="M48 104H64V120H48V104Z" fill="#D6C096"/>
|
14
|
+
</svg>
|
package/lib/baked/std.js
ADDED
@@ -0,0 +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"}]]]]]]]]
|