fez-lisp 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -12,7 +12,10 @@
12
12
  (= (mod n 5) 0) "Buzz"
13
13
  (*) n)))
14
14
 
15
- (go (range 1 100) (scan fizz-buzz) (log!))
15
+ (go
16
+ (math::range 1 100)
17
+ (array::map fizz-buzz)
18
+ (log!))
16
19
  ```
17
20
 
18
21
  ```lisp
@@ -26,29 +29,29 @@
26
29
  1456")
27
30
  ; solve part 1
28
31
  (let solve (lambda arr cb
29
- (fold arr (lambda a b (do
30
- (let res (binary-search arr (cb b)))
31
- (if res (merge a (Array res)) a)))
32
+ (array::fold arr (lambda a b (do
33
+ (let res (array::binary-search arr (cb b)))
34
+ (if res (merge a (array res)) a)))
32
35
  ())))
33
36
  ; 514579
34
37
  (go *input*
35
- (split "\n")
36
- (Strings->Numbers)
37
- (sort (lambda a b (> a b)))
38
+ (string::split "\n")
39
+ (cast::strings->numbers)
40
+ (array::sort (lambda a b (> a b)))
38
41
  (solve (lambda x (- 2020 x)))
39
- (product)
42
+ (math::product)
40
43
  (log!))
41
44
  ```
42
45
 
43
46
  ```lisp
44
47
  ; https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/description/
45
48
  (let max-count-of (lambda nums
46
- (max
47
- (count-of nums positive?)
48
- (count-of nums negative?))))
49
+ (math::max
50
+ (array::count-of nums math::positive?)
51
+ (array::count-of nums math::negative?))))
49
52
 
50
53
  (go
51
- (Array -2 -1 -1 0 0 1 2)
54
+ (array -2 -1 -1 0 0 1 2)
52
55
  (max-count-of)
53
56
  (log!)) ; 3
54
57
  ```
@@ -56,16 +59,16 @@
56
59
  ```lisp
57
60
  ; remove duplicate elements in the arr
58
61
  (let unique (lambda arr (go
59
- (let sorted (sort arr (safety lambda a b (> a b))))
60
- (zip (sequence sorted))
61
- (select (lambda x
62
+ (let sorted (array::sort arr (safety lambda a b (> a b))))
63
+ (array::zip (math::sequence sorted))
64
+ (array::select (lambda x
62
65
  (or (not (let index (car (cdr x))))
63
66
  (not (= (get sorted (- index 1)) (get sorted index))))))
64
- (scan car))))
67
+ (array::map car))))
65
68
  ; tests
66
69
  (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)))
70
+ (case "test 1" (unique (array 1)) (array 1))
71
+ (case "test 2" (unique (array 1 2 2 4 5 9 5 12 14 1)) (array 1 2 4 5 9 12 14)))
69
72
  ```
70
73
 
71
74
  <p align="center">
@@ -92,8 +95,8 @@ import { fez } from 'fez-lisp'
92
95
  eval(
93
96
  fez(
94
97
  `(go
95
- (range 1 11)
96
- (scan (lambda x (* x x)))
98
+ (math::range 1 11)
99
+ (array::map (lambda x (* x x)))
97
100
  (log!)))`,
98
101
  // include standard library
99
102
  // compile fez to JavaScript
@@ -113,7 +116,7 @@ fez(
113
116
  (= (mod n 5) 0) "Buzz"
114
117
  (*) n)))
115
118
 
116
- (go (range 1 100) (scan fizz-buzz) (log!))`,
119
+ (go (math::range 1 100) (array::map fizz-buzz) (log!))`,
117
120
  { std: true, errors: true, compile: false, shake: true }
118
121
  )
119
122
  ```
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":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"iteration"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],{"t":"w","v":"callback"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"scan"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"select"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"exclude"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"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":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"callback"},{"t":"w","v":"out"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},{"t":"w","v":"initial"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"every?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]],[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"some?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]],[{"t":"f","v":"type"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"w","v":"Boolean"}]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"find"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"car"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"has?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],{"t":"a","v":1},[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"reverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"merge"},[{"t":"f","v":"Array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"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":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"end"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"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":"arr"},[{"t":"f","v":"go"},[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"sort"},{"t":"w","v":"arr"},[{"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":"arr"},[{"t":"f","v":"fold"},{"t":"w","v":"arr"},[{"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":"arr"},[{"t":"f","v":"fold"},{"t":"w","v":"arr"},[{"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":"arr"},[{"t":"f","v":"fold"},{"t":"w","v":"arr"},[{"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":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"minimum"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"fold"},{"t":"w","v":"arr"},[{"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":"arr"}]]]],[{"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":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"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":"arr"},[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"Array-in-bounds?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"index"},[{"t":"f","v":"and"},[{"t":"f","v":"<"},{"t":"w","v":"index"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"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":"str"},[{"t":"f","v":"type"},{"t":"w","v":"str"},{"t":"w","v":"Array"}]]],[{"t":"f","v":"let"},{"t":"w","v":"Array->String"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"fold"},{"t":"w","v":"arr"},[{"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":"str"},[{"t":"f","v":"type"},{"t":"w","v":"str"},{"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":"arr"},[{"t":"f","v":"scan"},{"t":"w","v":"arr"},[{"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":"arr"},[{"t":"f","v":"scan"},{"t":"w","v":"arr"},[{"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->Char-Codes"},[{"t":"f","v":"lambda"},{"t":"w","v":"str"},[{"t":"f","v":"go"},{"t":"w","v":"str"},[{"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->Char-Codes"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"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":"Char-Codes->Chars"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"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":"Char-Codes->String"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"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":"arr"},{"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":"arr"},[{"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":"arr"},{"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":"arr"},{"t":"w","v":"target"},{"t":"a","v":0},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]]],[{"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":"str"},{"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":"str"},{"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":"arr"},{"t":"w","v":"delim"},[{"t":"f","v":"fold"},[{"t":"f","v":"zip"},{"t":"w","v":"arr"},[{"t":"f","v":"sequence"},{"t":"w","v":"arr"}]],[{"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":"arr"},[{"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":"arr"}]]]],[{"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":"arr"},{"t":"w","v":"i"},{"t":"w","v":"value"},[{"t":"f","v":"if"},[{"t":"f","v":"Array-in-bounds?"},{"t":"w","v":"arr"},{"t":"w","v":"i"}],[{"t":"f","v":"scan"},[{"t":"f","v":"sequence"},{"t":"w","v":"arr"}],[{"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":"arr"},{"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 arr bounds."}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"adjacent-difference"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"len"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"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":"arr"}]],[{"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":"arr"},[{"t":"f","v":"-"},{"t":"w","v":"i"},{"t":"a","v":1}]],[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"i"}]]]]],{"t":"w","v":"result"}]]],[{"t":"f","v":"iterate"},{"t":"a","v":1},{"t":"w","v":"arr"}]],{"t":"w","v":"arr"}]]]]]
1
+ export default [[{"t":"f","v":"let"},{"t":"w","v":"math::E"},{"t":"a","v":2.718281828459045}],[{"t":"f","v":"let"},{"t":"w","v":"math::PI"},{"t":"a","v":3.141592653589793}],[{"t":"f","v":"let*"},{"t":"w","v":"array::iteration"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"do"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"array::iteration"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],{"t":"w","v":"callback"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::map"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"array"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::select"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::exclude"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],[{"t":"f","v":"merge"},{"t":"w","v":"out"},[{"t":"f","v":"array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::fold"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"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":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"callback"},{"t":"w","v":"out"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},{"t":"w","v":"initial"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::every?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]],[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::some?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"if"},[{"t":"f","v":"and"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"not"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]],[{"t":"f","v":"type"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],{"t":"w","v":"boolean"}]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::find"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],[{"t":"f","v":"car"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::has?"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"when"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],{"t":"a","v":1},[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}]]]]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::reverse"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let*"},{"t":"w","v":"iterate"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"out"},[{"t":"f","v":"if"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}],[{"t":"f","v":"iterate"},[{"t":"f","v":"cdr"},{"t":"w","v":"arr"}],[{"t":"f","v":"merge"},[{"t":"f","v":"array"},[{"t":"f","v":"car"},{"t":"w","v":"arr"}]],{"t":"w","v":"out"}]],{"t":"w","v":"out"}]]],[{"t":"f","v":"iterate"},{"t":"w","v":"arr"},[]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::sequence"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"end"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"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":"math::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":"array::unique"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},[{"t":"f","v":"let"},{"t":"w","v":"sorted"},[{"t":"f","v":"array::sort"},{"t":"w","v":"arr"},[{"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":"math::sequence"},{"t":"w","v":"sorted"}]],[{"t":"f","v":"array::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":"array::map"},{"t":"w","v":"car"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::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":"array::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":"array::traverse"},{"t":"w","v":"y"},{"t":"w","v":"callback"}]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::summation"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::fold"},{"t":"w","v":"arr"},[{"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":"math::product"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::fold"},{"t":"w","v":"arr"},[{"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":"math::maximum"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::fold"},{"t":"w","v":"arr"},[{"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":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::minimum"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::fold"},{"t":"w","v":"arr"},[{"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":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"array::count-of"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"t":"f","v":"array::select"},{"t":"w","v":"callback"}],[{"t":"f","v":"length"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"math::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":"array::empty?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"not"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::array-in-bounds?"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"index"},[{"t":"f","v":"and"},[{"t":"f","v":"<"},{"t":"w","v":"index"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"t":"f","v":">="},{"t":"w","v":"index"},{"t":"a","v":0}]]]],[{"t":"f","v":"let"},{"t":"w","v":"cast::string->array"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"str"},[{"t":"f","v":"type"},{"t":"w","v":"str"},{"t":"w","v":"array"}]]],[{"t":"f","v":"let"},{"t":"w","v":"cast::array->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::fold"},{"t":"w","v":"arr"},[{"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":"cast::string->number"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"str"},[{"t":"f","v":"type"},{"t":"w","v":"str"},{"t":"w","v":"number"}]]],[{"t":"f","v":"let"},{"t":"w","v":"cast::number->string"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"n"},[{"t":"f","v":"type"},{"t":"w","v":"n"},{"t":"w","v":"string"}]]],[{"t":"f","v":"let"},{"t":"w","v":"cast::strings->numbers"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::map"},{"t":"w","v":"arr"},[{"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":"cast::numbers->strings"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"array::map"},{"t":"w","v":"arr"},[{"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":"cast::string->char-codes"},[{"t":"f","v":"lambda"},{"t":"w","v":"str"},[{"t":"f","v":"go"},{"t":"w","v":"str"},[{"t":"f","v":"type"},{"t":"w","v":"array"}],[{"t":"f","v":"array::map"},[{"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":"cast::chars->char-codes"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"t":"f","v":"array::map"},[{"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":"cast::char-codes->chars"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"t":"f","v":"array::map"},[{"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":"cast::char-codes->string"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"t":"f","v":"go"},{"t":"w","v":"arr"},[{"t":"f","v":"array::map"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"type"},{"t":"w","v":"x"},{"t":"w","v":"char"}]]],[{"t":"f","v":"cast::array->string"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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 (math::power)"}],[{"t":"f","v":"/"},[{"t":"f","v":"*"},{"t":"w","v":"base"},[{"t":"f","v":"math::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":"math::power"},{"t":"w","v":"base"},[{"t":"f","v":"-"},{"t":"w","v":"exp"},{"t":"a","v":1}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"math::greatest-common-divisor"},{"t":"w","v":"a"},{"t":"w","v":"b"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"math::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":"math::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":"math::sqrt-iter"},[{"t":"f","v":"improve-guess"},{"t":"w","v":"g"},{"t":"w","v":"x"}],{"t":"w","v":"x"}]]]],[{"t":"f","v":"math::sqrt-iter"},{"t":"a","v":1},{"t":"w","v":"x"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::hypotenuse"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"math::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":"math::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":"math::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":"math::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":"math::normalize"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"value"},{"t":"w","v":"math::min"},{"t":"w","v":"math::max"},[{"t":"f","v":"*"},[{"t":"f","v":"-"},{"t":"w","v":"value"},{"t":"w","v":"math::min"}],[{"t":"f","v":"/"},[{"t":"f","v":"-"},{"t":"w","v":"math::max"},{"t":"w","v":"math::min"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::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":"math::abs"},[{"t":"f","v":"-"},{"t":"w","v":"x2"},{"t":"w","v":"x1"}]],[{"t":"f","v":"math::abs"},[{"t":"f","v":"-"},{"t":"w","v":"y2"},{"t":"w","v":"y1"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"math::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":"math::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":"math::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":"math::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":"math::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":"is-prime"},[{"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":"is-prime"}],[{"t":"f","v":"iter"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}],{"t":"w","v":"end"}],{"t":"w","v":"is-prime"}]]]],[{"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":"math::sqrt"},{"t":"w","v":"n"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::slice"},[{"t":"f","v":"safety"},{"t":"w","v":"lambda"},{"t":"w","v":"arr"},{"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":"arr"},[{"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":"array::binary-search"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"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":"math::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":"arr"},{"t":"w","v":"target"},{"t":"a","v":0},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::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":"math::cartesian-product"},[{"t":"f","v":"lambda"},{"t":"w","v":"a"},{"t":"w","v":"b"},[{"t":"f","v":"array::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":"array::map"},{"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":"array::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":"array::some?"},[{"t":"f","v":"math::sequence"},{"t":"w","v":"a"}],[{"t":"f","v":"lambda"},{"t":"w","v":"i"},[{"t":"f","v":"not"},[{"t":"f","v":"array::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":"string::split"},[{"t":"f","v":"lambda"},{"t":"w","v":"str"},{"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":"str"},{"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":"array::zip"},[{"t":"f","v":"math::sequence"},{"t":"w","v":"input"}]],[{"t":"f","v":"array::map"},[{"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":"array::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":"array::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":"array::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":"array::map"},[{"t":"f","v":"lambda"},{"t":"w","v":"x"},[{"t":"f","v":"cast::array->string"},{"t":"w","v":"x"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::join"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"delim"},[{"t":"f","v":"array::fold"},[{"t":"f","v":"array::zip"},{"t":"w","v":"arr"},[{"t":"f","v":"math::sequence"},{"t":"w","v":"arr"}]],[{"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":"array::flat"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},[{"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":"array::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":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::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":"array::sort"},{"t":"w","v":"left"},{"t":"w","v":"callback"}],[{"t":"f","v":"array"},{"t":"w","v":"pivot"}],[{"t":"f","v":"array::sort"},{"t":"w","v":"right"},{"t":"w","v":"callback"}]]]]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::update"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"i"},{"t":"w","v":"value"},[{"t":"f","v":"if"},[{"t":"f","v":"array::array-in-bounds?"},{"t":"w","v":"arr"},{"t":"w","v":"i"}],[{"t":"f","v":"array::map"},[{"t":"f","v":"math::sequence"},{"t":"w","v":"arr"}],[{"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":"arr"},{"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":"array::adjacent-difference"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"len"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"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":"arr"}]],[{"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":"arr"},[{"t":"f","v":"-"},{"t":"w","v":"i"},{"t":"a","v":1}]],[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"i"}]]]]],{"t":"w","v":"result"}]]],[{"t":"f","v":"iterate"},{"t":"a","v":1},{"t":"w","v":"arr"}]],{"t":"w","v":"arr"}]]]],[{"t":"f","v":"let"},{"t":"w","v":"array::adjacent-find"},[{"t":"f","v":"lambda"},{"t":"w","v":"arr"},{"t":"w","v":"callback"},[{"t":"f","v":"do"},[{"t":"f","v":"let"},{"t":"w","v":"len"},[{"t":"f","v":"length"},{"t":"w","v":"arr"}]],[{"t":"f","v":"otherwise"},[{"t":"f","v":"="},{"t":"w","v":"len"},{"t":"a","v":1}],[{"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":"len"}],[{"t":"f","v":"if"},[{"t":"f","v":"callback"},[{"t":"f","v":"let"},{"t":"w","v":"prev"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},[{"t":"f","v":"-"},{"t":"w","v":"i"},{"t":"a","v":1}]]],[{"t":"f","v":"let"},{"t":"w","v":"current"},[{"t":"f","v":"get"},{"t":"w","v":"arr"},{"t":"w","v":"i"}]]],{"t":"w","v":"prev"},[{"t":"f","v":"iterate"},[{"t":"f","v":"+"},{"t":"w","v":"i"},{"t":"a","v":1}]]]]]],[{"t":"f","v":"iterate"},{"t":"a","v":1}]]]]]]]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Immutable Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.0.2",
5
+ "version": "1.0.4",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/compiler.js CHANGED
@@ -21,24 +21,22 @@ return result
21
21
  throw new Error(error)
22
22
  }`,
23
23
  serialise:
24
- "_serialise=(ast)=>{\n if(ast==undefined) return '()'\n else if(typeofast==='object')\n if(Array.isArray(ast)) return `(Array ${ast.map(stringify).join(' ')})`\n else\n return `(Array ${Object.entries(ast).map(([key, value]) => `(\"${key}\" ${stringify(value)})`).join(' ')})`\n else if(typeofast==='string') return `\"${ast}\"`\n else if(typeofast==='function') return '()'\n else return ast\n}",
24
+ "_serialise=(ast)=>{\n if(ast==undefined) return '()'\n else if(typeofast==='object')\n if(Array.isArray(ast)) return `(array ${ast.map(stringify).join(' ')})`\n else\n return `(array ${Object.entries(ast).map(([key, value]) => `(\"${key}\" ${stringify(value)})`).join(' ')})`\n else if(typeofast==='string') return `\"${ast}\"`\n else if(typeofast==='function') return '()'\n else return ast\n}",
25
25
  cast: `_cast=(type,value)=>{
26
26
  switch (type) {
27
- case 'Number':
27
+ case '${KEYWORDS.NUMBER_TYPE}':
28
28
  return Number(value)
29
- case 'String':
29
+ case '${KEYWORDS.STRING_TYPE}':
30
30
  return value.toString()
31
- case 'Array':
31
+ case '${KEYWORDS.ARRAY_TYPE}':
32
32
  return typeof value==='number'?[...Number(value).toString()].map(Number):[...value]
33
- case 'Bit':
34
- return parseInt(value,2)
35
- case 'Boolean':
33
+ case '${KEYWORDS.BOOLEAN_TYPE}':
36
34
  return +!!value
37
- case 'Function':
35
+ case '${KEYWORDS.ANONYMOUS_FUNCTION}':
38
36
  return ()=>value
39
- case 'Char-Code':
37
+ case '${KEYWORDS.CHAR_CODE_TYPE}':
40
38
  return String.fromCharCode(value)
41
- case 'Char':
39
+ case '${KEYWORDS.CHAR_TYPE}':
42
40
  return value.charCodeAt(0)
43
41
  default:
44
42
  return 0
@@ -136,8 +134,6 @@ const compile = (tree, Variables) => {
136
134
  Arguments[1][VALUE] === 'length'
137
135
  ? `(new Array(${compile(Arguments[0], Variables)}).fill(0))`
138
136
  : `[${parseArgs(Arguments, Variables)}];`
139
- case KEYWORDS.FUNCTION_TYPE:
140
- return '(()=>{});'
141
137
  case KEYWORDS.ARRAY_OR_STRING_LENGTH:
142
138
  return `(${compile(Arguments[0], Variables)}).length`
143
139
  case KEYWORDS.IS_ATOM:
package/src/enums.js CHANGED
@@ -8,22 +8,20 @@ export const ATOM = 'a'
8
8
  export const PLACEHOLDER = '.'
9
9
  // keywords aliases
10
10
  export const KEYWORDS = {
11
- BIT_TYPE: 'Bit',
12
- STRING_TYPE: 'String',
13
- NUMBER_TYPE: 'Number',
14
- BOOLEAN_TYPE: 'Boolean',
15
- FUNCTION_TYPE: 'Lambda',
16
- ARRAY_TYPE: 'Array',
17
- CHAR_CODE_TYPE: 'Char-Code',
18
- CHAR_TYPE: 'Char',
11
+ STRING_TYPE: 'string',
12
+ NUMBER_TYPE: 'number',
13
+ BOOLEAN_TYPE: 'boolean',
14
+ ARRAY_TYPE: 'array',
15
+ CHAR_CODE_TYPE: 'char-code',
16
+ CHAR_TYPE: 'char',
19
17
 
20
18
  CAST_TYPE: 'type',
21
19
  CONCATENATION: 'concatenate',
22
20
  ARRAY_OR_STRING_LENGTH: 'length',
23
- IS_ARRAY: 'Array?',
24
- IS_NUMBER: 'Number?',
25
- IS_STRING: 'String?',
26
- IS_FUNCTION: 'Lambda?',
21
+ IS_ARRAY: 'array?',
22
+ IS_NUMBER: 'number?',
23
+ IS_STRING: 'string?',
24
+ IS_FUNCTION: 'lambda?',
27
25
 
28
26
  ADDITION: '+',
29
27
  SUBTRACTION: '-',
@@ -38,8 +36,8 @@ export const KEYWORDS = {
38
36
  BITWISE_LEFT_SHIFT: '<<',
39
37
  BITWISE_RIGHT_SHIFT: '>>',
40
38
  BITWISE_UNSIGNED_RIGHT_SHIFT: '>>>',
41
- ATOM: 'Atom',
42
- IS_ATOM: 'Atom?',
39
+ ATOM: 'atom',
40
+ IS_ATOM: 'atom?',
43
41
  FIRST_ARRAY: 'car',
44
42
  REST_ARRAY: 'cdr',
45
43
  GET_ARRAY: 'get',
package/src/parser.js CHANGED
@@ -46,9 +46,9 @@ export const parse = (source) => {
46
46
  export const stringify = (ast) => {
47
47
  if (ast == undefined) return '()'
48
48
  else if (typeof ast === 'object')
49
- if (Array.isArray(ast)) return `(Array ${ast.map(stringify).join(' ')})`
49
+ if (Array.isArray(ast)) return `(array ${ast.map(stringify).join(' ')})`
50
50
  else
51
- return `(Array ${Object.entries(ast)
51
+ return `(array ${Object.entries(ast)
52
52
  .map(([key, value]) => `("${key}" ${stringify(value)})`)
53
53
  .join(' ')})`
54
54
  else if (typeof ast === 'string') return `"${ast}"`
package/src/tokeniser.js CHANGED
@@ -650,7 +650,6 @@ const keywords = {
650
650
  [KEYWORDS.STRING_TYPE]: () => '',
651
651
  [KEYWORDS.NUMBER_TYPE]: () => 0,
652
652
  [KEYWORDS.BOOLEAN_TYPE]: () => 1,
653
- [KEYWORDS.FUNCTION_TYPE]: () => () => {},
654
653
  [KEYWORDS.CAST_TYPE]: (args, env) => {
655
654
  if (args.length !== 2)
656
655
  throw new RangeError(
@@ -678,12 +677,8 @@ const keywords = {
678
677
  }
679
678
  case KEYWORDS.STRING_TYPE:
680
679
  return value.toString()
681
- case KEYWORDS.BIT_TYPE:
682
- return parseInt(value, 2)
683
680
  case KEYWORDS.BOOLEAN_TYPE:
684
681
  return +!!value
685
- case KEYWORDS.FUNCTION_TYPE:
686
- return () => value
687
682
  case KEYWORDS.ARRAY_TYPE: {
688
683
  if (typeof value === 'number')
689
684
  return [...Number(value).toString()].map(Number)
@@ -731,31 +726,15 @@ const keywords = {
731
726
  throw new TypeError(
732
727
  `Can only cast (or ${KEYWORDS.NUMBER_TYPE} ${
733
728
  KEYWORDS.STRING_TYPE
734
- } ${KEYWORDS.ARRAY_TYPE} ${KEYWORDS.BIT_TYPE} ${
735
- KEYWORDS.BOOLEAN_TYPE
736
- } ${KEYWORDS.CHAR_TYPE} ${KEYWORDS.CHAR_CODE_TYPE}) at (${
729
+ } ${KEYWORDS.ARRAY_TYPE} ${KEYWORDS.BOOLEAN_TYPE} ${
730
+ KEYWORDS.CHAR_TYPE
731
+ } ${KEYWORDS.CHAR_CODE_TYPE}) at (${KEYWORDS.CAST_TYPE}) (${
737
732
  KEYWORDS.CAST_TYPE
738
- }) (${KEYWORDS.CAST_TYPE} ${stringifyArgs(args)}).`
733
+ } ${stringifyArgs(args)}).`
739
734
  )
740
735
  }
741
736
  }
742
737
  },
743
- [KEYWORDS.BIT_TYPE]: (args, env) => {
744
- if (args.length !== 1)
745
- throw new RangeError(
746
- `Invalid number of arguments to (${KEYWORDS.BIT_TYPE}) (1 required). (${
747
- KEYWORDS.BIT_TYPE
748
- } ${stringifyArgs(args)})`
749
- )
750
- const operand = evaluate(args[0], env)
751
- if (typeof operand !== 'number')
752
- throw new TypeError(
753
- `Argument of (${KEYWORDS.BIT_TYPE}) is not a (${
754
- KEYWORDS.NUMBER_TYPE
755
- }) (${KEYWORDS.BIT_TYPE} ${stringifyArgs(args)}).`
756
- )
757
- return (operand >>> 0).toString(2)
758
- },
759
738
  [KEYWORDS.BITWISE_AND]: (args, env) => {
760
739
  if (args.length < 2)
761
740
  throw new RangeError(
@@ -886,7 +865,7 @@ const keywords = {
886
865
  if (!Array.isArray(args[i]))
887
866
  throw new TypeError(
888
867
  `Argument at position (${i}) of (${KEYWORDS.PIPE}) is not a (${
889
- KEYWORDS.FUNCTION_TYPE
868
+ KEYWORDS.ANONYMOUS_FUNCTION
890
869
  }). (${KEYWORDS.PIPE} ${stringifyArgs(args)})`
891
870
  )
892
871
  const [first, ...rest] = args[i]
package/src/utils.js CHANGED
@@ -20,8 +20,8 @@ export const isBalancedParenthesis = (sourceCode) => {
20
20
  else if (str[i] in pairs) if (stack.pop() !== pairs[str[i]]) ++count
21
21
  return count - stack.length
22
22
  }
23
- export const escape = (char) => {
24
- switch (char) {
23
+ export const escape = (Char) => {
24
+ switch (Char) {
25
25
  case '\\':
26
26
  return '\\'
27
27
  case 'n':
@@ -132,7 +132,7 @@ export const treeShake = (ast, libs) => {
132
132
  const deps = libs.reduce((a, x) => a.add(x.at(1)[VALUE]), new Set())
133
133
  const visited = new Set()
134
134
  const dfs = (tree) => {
135
- if (Array.isArray(tree)) tree.forEach((a) => dfs(a))
135
+ if (Array.isArray(tree)) tree.forEach(dfs)
136
136
  else if (
137
137
  (tree[TYPE] === APPLY || tree[TYPE] === WORD) &&
138
138
  deps.has(tree[VALUE]) &&
@@ -201,6 +201,8 @@ export const dotNamesToEmpty = (name) => name.replace(new RegExp(/\./g), '')
201
201
  export const colonNamesTo$ = (name) => name.replace(new RegExp(/\:/g), '$')
202
202
  export const commaToLodash = (name) => name.replace(new RegExp(/\,/g), '_')
203
203
  export const arrowToTo = (name) => name.replace(new RegExp(/->/g), '-to-')
204
+ export const moduleNameToNothing = (name) => name.replace(new RegExp(/::/g), '')
205
+
204
206
  export const questionMarkToLodash = (name) =>
205
207
  name.replace(new RegExp(/\?/g), 'Predicate')
206
208
  export const exclamationMarkMarkToLodash = (name) =>
@@ -231,7 +233,9 @@ export const lispToJavaScriptVariableName = (name) =>
231
233
  dotNamesToEmpty(
232
234
  colonNamesTo$(
233
235
  exclamationMarkMarkToLodash(
234
- questionMarkToLodash(commaToLodash(earMuffsToLodashes(name)))
236
+ questionMarkToLodash(
237
+ commaToLodash(moduleNameToNothing(earMuffsToLodashes(name)))
238
+ )
235
239
  )
236
240
  )
237
241
  )
package/cli/index.js DELETED
@@ -1,162 +0,0 @@
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
- }