diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 43649e4..b4fe272 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -144,20 +144,20 @@ function Library (ronin) { // Math - this.add = function (a, b) { - return a + b + this.add = function (...args) { + return args.reduce((sum, val) => sum + val) } - this.sub = function (a, b) { - return a - b + this.sub = function (...args) { + return args.reduce((sum, val) => sum - val) } - this.mul = function (a, b) { - return a * b + this.mul = function (...args) { + return args.reduce((sum, val) => sum * val) } - - this.div = function (a, b) { - return a / b + + this.div = function (...args) { + return args.reduce((sum, val) => sum / val) } this.mod = function (a, b) { diff --git a/examples/math.lisp b/examples/math.lisp new file mode 100644 index 0000000..7a6906e --- /dev/null +++ b/examples/math.lisp @@ -0,0 +1,5 @@ +( + (echo (add 2 3)) + (echo (sub 22 3 4 5)) + (echo (mul 2 3 4 5)) +) \ No newline at end of file