diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/js/README.md | 2 | ||||
-rw-r--r-- | lisp/js/l.html | 4 | ||||
-rw-r--r-- | lisp/js/lisp.js | 16 |
3 files changed, 11 insertions, 11 deletions
diff --git a/lisp/js/README.md b/lisp/js/README.md index 2f10a7e..add85c9 100644 --- a/lisp/js/README.md +++ b/lisp/js/README.md @@ -30,7 +30,7 @@ To run in the browser: </html> ``` -`lisp.run()` is a convinence, it wraps `lisp.interpret(lisp.parse())`. +`lisp.run()` is a convenience, it wraps `lisp.interpret(lisp.parse())`. See also: diff --git a/lisp/js/l.html b/lisp/js/l.html index 9784596..cd716f3 100644 --- a/lisp/js/l.html +++ b/lisp/js/l.html @@ -16,12 +16,12 @@ (concat "banana " "oatmeal " "waffels")) (def foo - (add 1 2)) + (+ 1 2)) (print foo) (def bar - (add (add 3 3) 3)) + (+ (+ 3 3) 3)) (print bar) diff --git a/lisp/js/lisp.js b/lisp/js/lisp.js index ee2b88d..3adb154 100644 --- a/lisp/js/lisp.js +++ b/lisp/js/lisp.js @@ -17,23 +17,23 @@ }, // math - add: (...args) => { + '+': (...args) => { return args.reduce((sum, val) => sum + val); }, - sub: (...args) => { // Subtracts values. + '-': (...args) => { // Subtracts values. return args.reduce((sum, val) => sum - val); }, - mul: (...args) => { // Multiplies values. + '*': (...args) => { // Multiplies values. return args.reduce((sum, val) => sum * val); }, - div: (...args) => { // Divides values. + '/': (...args) => { // Divides values. return args.reduce((sum, val) => sum / val); }, - mod: (a, b) => { // Returns the modulo of a and b. + '%': (a, b) => { // Returns the modulo of a and b. return a % b; }, @@ -78,15 +78,15 @@ }, // logic - gt: (a, b) => { // Returns true if a is greater than b, else false. + '>': (a, b) => { // Returns true if a is greater than b, else false. return a > b; }, - lt: (a, b) => { // Returns true if a is less than b, else false. + '<': (a, b) => { // Returns true if a is less than b, else false. return a < b; }, - eq: (a, b) => { // Returns true if a is equal to b, else false. + '=': (a, b) => { // Returns true if a is equal to b, else false. return a === b; }, |