From 805e9ccb28c744574752ed4adbaf422affb0cfd7 Mon Sep 17 00:00:00 2001 From: Quentin Leonetti Date: Sat, 13 Jul 2019 17:58:04 +0200 Subject: [PATCH] adds print and map --- desktop/sources/scripts/library.js | 8 ++++++++ examples/arrays.lisp | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 examples/arrays.lisp diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 647d6a6..083282e 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -24,6 +24,14 @@ function Library (ronin) { // TODO: Closes Ronin } + this.print = (...args) => { + console.log(...args) + } + + this.map = (fn, arr) => { + return arr.map(fn) + } + // Rects this.pos = (x, y, t = 'pos') => { diff --git a/examples/arrays.lisp b/examples/arrays.lisp new file mode 100644 index 0000000..97fad47 --- /dev/null +++ b/examples/arrays.lisp @@ -0,0 +1,8 @@ +(print (map (lambda (a) (add a 1)) (1 2 3))) + +( + (clear) + (map (lambda (a) + (stroke (rect (mul a 30) 20 50 50) 1 "red")) + (5 10 15 20)) +) \ No newline at end of file