fez-lisp 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -13,8 +13,8 @@
13
13
  (*) n)))
14
14
 
15
15
  (pi
16
- (math::range 1 100)
17
- (array::map fizz-buzz)
16
+ (math:range 1 100)
17
+ (array:map fizz-buzz)
18
18
  (log!))
19
19
  ```
20
20
 
@@ -29,26 +29,26 @@
29
29
  1456")
30
30
  ; solve part 1
31
31
  (let solve (lambda arr cb
32
- (array::fold arr (lambda a b (do
33
- (let res (array::binary-search arr (cb b)))
32
+ (array:fold arr (lambda a b (do
33
+ (let res (array:binary-search arr (cb b)))
34
34
  (if res (merge a (array res)) a)))
35
35
  ())))
36
36
  ; 514579
37
37
  (pi *input*
38
- (string::split "\n")
39
- (cast::strings->numbers)
40
- (array::sort (lambda a b (> a b)))
38
+ (string:split "\n")
39
+ (cast:strings->numbers)
40
+ (array:sort (lambda a b (> a b)))
41
41
  (solve (lambda x (- 2020 x)))
42
- (math::product)
42
+ (math:product)
43
43
  (log!))
44
44
  ```
45
45
 
46
46
  ```lisp
47
47
  ; https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/description/
48
48
  (let max-count-of (lambda nums
49
- (math::max
50
- (array::count-of nums math::positive?)
51
- (array::count-of nums math::negative?))))
49
+ (math:max
50
+ (array:count-of nums math:positive?)
51
+ (array:count-of nums math:negative?))))
52
52
 
53
53
  (pi
54
54
  (array -2 -1 -1 0 0 1 2)
@@ -59,12 +59,12 @@
59
59
  ```lisp
60
60
  ; remove duplicate elements in the arr
61
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
+ (let sorted (array:sort arr (safety lambda a b (> a b))))
63
+ (array:zip (math:sequence sorted))
64
+ (array:select (lambda x
65
65
  (or (not (let index (car (cdr x))))
66
66
  (not (= (get sorted (- index 1)) (get sorted index))))))
67
- (array::map car))))
67
+ (array:map car))))
68
68
  ; tests
69
69
  (assert
70
70
  (case "test 1" (unique (array 1)) (array 1))
@@ -95,8 +95,8 @@ import { fez } from 'fez-lisp'
95
95
  eval(
96
96
  fez(
97
97
  `(pi
98
- (math::range 1 11)
99
- (array::map (lambda x (* x x)))
98
+ (math:range 1 11)
99
+ (array:map (lambda x (* x x)))
100
100
  (log!)))`,
101
101
  // include standard library
102
102
  // compile fez to JavaScript
@@ -116,7 +116,7 @@ fez(
116
116
  (= (mod n 5) 0) "Buzz"
117
117
  (*) n)))
118
118
 
119
- (pi (math::range 1 100) (array::map fizz-buzz) (log!))`,
119
+ (pi (math:range 1 100) (array:map fizz-buzz) (log!))`,
120
120
  { std: true, errors: true, compile: false, shake: true }
121
121
  )
122
122
  ```