fez-lisp 1.4.20 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,8 +14,8 @@
14
14
  (let x 42)
15
15
  ; But array items are not
16
16
  (let arr (array 1 2 3))
17
- (set! arr 0 10)
18
- (set! arr (length arr) 100)
17
+ (alter! arr 0 10)
18
+ (alter! arr (length arr) 100)
19
19
  ; arr is now will make it [10 2 3 100]
20
20
  ; No strings - instead they are array of charcodes
21
21
  "Hello World!" ; This is syntactic suggar turning it into the one below
@@ -108,13 +108,13 @@ console.log(compile(parse("(+ 1 2)")))
108
108
  console.log(compile(parse("(math:power 2 4)")))
109
109
  // (()=>{;return(()=>{var math_power;return (math_power=((base,exp)=>{return (+(exp<0)?(+(base===0)?[]:(1/(base*math_power(base,((exp*-1)-1))))):(+(exp===0)?1:(+(exp===1)?base:(1?(base*math_power(base,(exp-1))):0))));}),math_power(2,4));})()})()
110
110
  console.log(compile(parse("(|> [1 2 3 4] (array:map math:square) (math:summation))")))
111
- /* (()=>{var __tco=fn=>(...args)=>{let result=fn(...args);while(typeof result==='function')result=result();return result},length=(arr)=>arr.length,set_effect=function(array,index,value){if(arguments.length===1){array.pop()}else{array[index] = value};return array},get=(arr,i)=>arr[i];
112
- ;return(()=>{var math_summation,math_square,array_map,array_fold;return (math_summation=((xs)=>{return array_fold(xs,((a,b)=>{return (a+b);}),0);}),math_square=((x)=>{return (x*x);}),array_map=((xs,callback)=>{var recursive_array_map,recursive_9271675;return ((recursive_array_map=(__tco(recursive_9271675=(i,out)=>{return (+(length(xs)>i)?()=>recursive_9271675((i+1),set_effect(out,length(out),callback(get(xs, i)))):out);}, recursive_9271675))),recursive_array_map(0,[]));}),array_fold=((xs,callback,initial)=>{var recursive_array_fold,recursive_927729;return ((recursive_array_fold=(__tco(recursive_927729=(i,out)=>{return (+(length(xs)>i)?()=>recursive_927729((i+1),callback(out,get(xs, i))):out);}, recursive_927729))),recursive_array_fold(0,initial));}),math_summation(array_map([1,2,3,4],math_square)));})()})() * /
111
+ /* (()=>{var __tco=fn=>(...args)=>{let result=fn(...args);while(typeof result==='function')result=result();return result},length=(arr)=>arr.length,alter_effect=function(array,index,value){if(arguments.length===1){array.pop()}else{array[index] = value};return array},get=(arr,i)=>arr[i];
112
+ ;return(()=>{var math_summation,math_square,array_map,array_fold;return (math_summation=((xs)=>{return array_fold(xs,((a,b)=>{return (a+b);}),0);}),math_square=((x)=>{return (x*x);}),array_map=((xs,callback)=>{var recursive_array_map,recursive_9271675;return ((recursive_array_map=(__tco(recursive_9271675=(i,out)=>{return (+(length(xs)>i)?()=>recursive_9271675((i+1),alter_effect(out,length(out),callback(get(xs, i)))):out);}, recursive_9271675))),recursive_array_map(0,[]));}),array_fold=((xs,callback,initial)=>{var recursive_array_fold,recursive_927729;return ((recursive_array_fold=(__tco(recursive_927729=(i,out)=>{return (+(length(xs)>i)?()=>recursive_927729((i+1),callback(out,get(xs, i))):out);}, recursive_927729))),recursive_array_fold(0,initial));}),math_summation(array_map([1,2,3,4],math_square)));})()})() * /
113
113
  ```
114
114
 
115
115
  ```lisp
116
116
  ; Build-in all keywords
117
117
  (/ ...) (+ ...) (* ...) (- ...) (= ...) (< ...) (> ...) (>= ...) (<= ...) (& ...) (~ ...) (| ...) (^ ...) (<< ...) (>> ...) (>>> ...)
118
118
  (mod ...) (let ...) (if ...) (not ...) (and ...) (or ...) (atom? ...) (lambda? ...)
119
- (length ...) (do ...) (array ...) (set! ...) (get ...) (lambda ...) (apply ...) (throw ...)
119
+ (length ...) (do ...) (array ...) (alter! ...) (get ...) (lambda ...) (apply ...) (throw ...)
120
120
  ```
@@ -168,7 +168,7 @@ export const SLICE_RAW = [
168
168
  [2, 1]
169
169
  ],
170
170
  [
171
- [0, 'set!'],
171
+ [0, 'alter!'],
172
172
  [1, 'out'],
173
173
  [
174
174
  [0, 'length'],