From: David Vázquez Date: Sun, 20 Jan 2013 14:54:15 +0000 (+0000) Subject: Typo X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b88ee1e1204f844fa1cff782573d06e32d5ee78b;p=jscl.git Typo --- diff --git a/ecmalisp.lisp b/ecmalisp.lisp index d042b08..f2fc32e 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -1534,7 +1534,7 @@ decls) (concat "return " (progn ,@body) ";" *newline*))) -;;; VARIABLE-ARITY compiles variable arity operations. ARGS stand for +;;; VARIABLE-ARITY compiles variable arity operations. ARGS stands for ;;; a variable which holds a list of forms. It will compile them and ;;; store the result in some Javascript variables. BODY is evaluated ;;; with ARGS bound to the list of these variables to generate the @@ -1564,12 +1564,22 @@ (concat "return " ,@body ";" *newline*)))) +(define-raw-builtin + (&rest numbers) + (variable-arity numbers + (join numbers "+"))) + +(define-raw-builtin - (x &rest others) + (let ((args (cons x others))) + (variable-arity args + (if (null others) + (concat "-" (car args)) + (join args "+"))))) + + (defun num-op-num (x op y) (type-check (("x" "number" x) ("y" "number" y)) (concat "x" op "y"))) -(define-builtin + (x y) (num-op-num x "+" y)) -(define-builtin - (x y) (num-op-num x "-" y)) (define-builtin * (x y) (num-op-num x "*" y)) (define-builtin / (x y) (num-op-num x "/" y))