diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 083282e..f054041 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -28,10 +28,19 @@ function Library (ronin) { console.log(...args) } + // Arrays this.map = (fn, arr) => { return arr.map(fn) } + this.first = (arr) => { + return arr[0] + } + + this.rest = ([_, ...arr]) => { + return arr + } + // Rects this.pos = (x, y, t = 'pos') => { diff --git a/examples/arrays.lisp b/examples/arrays.lisp index 97fad47..76306e6 100644 --- a/examples/arrays.lisp +++ b/examples/arrays.lisp @@ -1,5 +1,10 @@ (print (map (lambda (a) (add a 1)) (1 2 3))) +( + (print (first (1 2 3))) + (print (rest (1 2 3))) +) + ( (clear) (map (lambda (a)