fez-lisp 1.0.3 → 1.0.5

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
+ (pi
16
+ (math::range 1 100)
17
+ (array::map fizz-buzz)
18
+ (log!))
16
19
  ```
17
20
 
18
21
  ```lisp
@@ -26,46 +29,46 @@
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
- (go *input*
35
- (split "\n")
36
- (Strings->Numbers)
37
- (sort (lambda a b (> a b)))
37
+ (pi *input*
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
- (go
51
- (Array -2 -1 -1 0 0 1 2)
53
+ (pi
54
+ (array -2 -1 -1 0 0 1 2)
52
55
  (max-count-of)
53
56
  (log!)) ; 3
54
57
  ```
55
58
 
56
59
  ```lisp
57
60
  ; remove duplicate elements in the arr
58
- (let unique (lambda arr (go
59
- (let sorted (sort arr (safety lambda a b (> a b))))
60
- (zip (sequence sorted))
61
- (select (lambda x
61
+ (let unique (lambda arr (pi
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">
@@ -91,9 +94,9 @@ fez(`(+ 1 "2")`, { errors: true })
91
94
  import { fez } from 'fez-lisp'
92
95
  eval(
93
96
  fez(
94
- `(go
95
- (range 1 11)
96
- (scan (lambda x (* x x)))
97
+ `(pi
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
+ (pi (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":"pi"},[{"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":"pi"},{"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":"pi"},{"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":"pi"},{"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":"pi"},{"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":"pi"},{"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":"pi"},{"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":"w","v":"number?"}]],[{"t":"f","v":"pi"},{"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.3",
5
+ "version": "1.0.5",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/compiler.js CHANGED
@@ -16,29 +16,31 @@ let result=fn(...args)
16
16
  while(typeof result==='function')result=result()
17
17
  return result
18
18
  }`,
19
- atom: `_isAtom=(value)=>typeof value==='number'||typeof value==='string'`,
19
+ isNumber: `numberPredicate=(number)=>typeof number==='number'`,
20
+ isString: `stringPredicate=(string)=>typeof number==='string'`,
21
+ isLambda: `lambdaPredicate=(lambda)=>typeof lambda==='function'`,
22
+ isArray: `arrayPredicate=(array)=>Array.isArray(array)`,
23
+ isAtom: `atomPredicate=(value)=>typeof value==='number'||typeof value==='string'`,
20
24
  error: `_error=(error)=>{
21
25
  throw new Error(error)
22
26
  }`,
23
27
  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}",
28
+ "_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
29
  cast: `_cast=(type,value)=>{
26
30
  switch (type) {
27
- case 'Number':
31
+ case '${KEYWORDS.NUMBER_TYPE}':
28
32
  return Number(value)
29
- case 'String':
33
+ case '${KEYWORDS.STRING_TYPE}':
30
34
  return value.toString()
31
- case 'Array':
35
+ case '${KEYWORDS.ARRAY_TYPE}':
32
36
  return typeof value==='number'?[...Number(value).toString()].map(Number):[...value]
33
- case 'Bit':
34
- return parseInt(value,2)
35
- case 'Boolean':
37
+ case '${KEYWORDS.BOOLEAN_TYPE}':
36
38
  return +!!value
37
- case 'Function':
39
+ case '${KEYWORDS.ANONYMOUS_FUNCTION}':
38
40
  return ()=>value
39
- case 'Char-Code':
41
+ case '${KEYWORDS.CHAR_CODE_TYPE}':
40
42
  return String.fromCharCode(value)
41
- case 'Char':
43
+ case '${KEYWORDS.CHAR_TYPE}':
42
44
  return value.charCodeAt(0)
43
45
  default:
44
46
  return 0
@@ -112,20 +114,22 @@ const compile = (tree, Variables) => {
112
114
  }
113
115
  case KEYWORDS.IS_STRING:
114
116
  return handleBoolean(
115
- `(typeof(${compile(Arguments[0], Variables)})==='string');`
117
+ `stringPredicate(${compile(Arguments[0], Variables)});`
116
118
  )
117
119
  case KEYWORDS.IS_NUMBER:
118
120
  return handleBoolean(
119
- `(typeof(${compile(Arguments[0], Variables)})==='number');`
121
+ `numberPredicate(${compile(Arguments[0], Variables)});`
120
122
  )
121
123
  case KEYWORDS.IS_FUNCTION:
122
- return `(typeof(${compile(Arguments[0], Variables)})==='function');`
124
+ return handleBoolean(
125
+ `lambdaPredicate(${compile(Arguments[0], Variables)});`
126
+ )
123
127
  case KEYWORDS.IS_ARRAY:
124
- return `(Array.isArray(${compile(Arguments[0], Variables)}));`
128
+ return handleBoolean(
129
+ `arrayPredicate(${compile(Arguments[0], Variables)});`
130
+ )
125
131
  case KEYWORDS.NUMBER_TYPE:
126
132
  return '0'
127
- case KEYWORDS.INTEGER_TYPE:
128
- return '0n'
129
133
  case KEYWORDS.BOOLEAN_TYPE:
130
134
  return '1'
131
135
  case KEYWORDS.STRING_TYPE:
@@ -136,12 +140,12 @@ const compile = (tree, Variables) => {
136
140
  Arguments[1][VALUE] === 'length'
137
141
  ? `(new Array(${compile(Arguments[0], Variables)}).fill(0))`
138
142
  : `[${parseArgs(Arguments, Variables)}];`
139
- case KEYWORDS.FUNCTION_TYPE:
140
- return '(()=>{});'
141
143
  case KEYWORDS.ARRAY_OR_STRING_LENGTH:
142
144
  return `(${compile(Arguments[0], Variables)}).length`
143
145
  case KEYWORDS.IS_ATOM:
144
- return handleBoolean(`_isAtom(${compile(Arguments[0], Variables)});`)
146
+ return handleBoolean(
147
+ `atomPredicate(${compile(Arguments[0], Variables)});`
148
+ )
145
149
  case KEYWORDS.FIRST_ARRAY:
146
150
  return `${compile(Arguments[0], Variables)}.at(0);`
147
151
  case KEYWORDS.REST_ARRAY:
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',
@@ -66,7 +64,7 @@ export const KEYWORDS = {
66
64
  CALL_FUNCTION: 'apply',
67
65
  DEFINE_VARIABLE: 'let',
68
66
 
69
- PIPE: 'go',
67
+ PIPE: 'pi',
70
68
  THROW_ERROR: 'throw',
71
69
  TAIL_CALLS_OPTIMISED_RECURSIVE_FUNCTION: 'let*',
72
70
  IMMUTABLE_FUNCTION: 'safety',
@@ -2,8 +2,8 @@ import { APPLY, ATOM, KEYWORDS, TYPE, VALUE, WORD } from './enums.js'
2
2
  import { keywords } from './tokeniser.js'
3
3
  import { stringifyArgs } from './utils.js'
4
4
 
5
- export const evaluate = (expression, env) => {
6
- const [first, ...rest] = Array.isArray(expression) ? expression : [expression]
5
+ export const evaluate = (exp, env) => {
6
+ const [first, ...rest] = Array.isArray(exp) ? exp : [exp]
7
7
  if (first == undefined) return []
8
8
  switch (first[TYPE]) {
9
9
  case WORD: {
@@ -27,7 +27,7 @@ export const evaluate = (expression, env) => {
27
27
  return first[VALUE]
28
28
  default:
29
29
  throw new ReferenceError(
30
- `Attempting to acces Undefined near ${stringifyArgs(expression)}`
30
+ `Attempting to acces Undefined near ${stringifyArgs(exp)}`
31
31
  )
32
32
  }
33
33
  }
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':
@@ -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
  )