X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=test.lisp;h=a85dabaf9dae68350c902eb54fbc953e1099daca;hb=cde0e46ceeba0bf1eafcf43b13cd95a7eb14e6f7;hp=2f4dd3543c4428396f8134a73eb5186e75f6dad5;hpb=4ad36a3415efc56d1348f9c705b6c436ed488a3f;p=jscl.git diff --git a/test.lisp b/test.lisp index 2f4dd35..a85daba 100644 --- a/test.lisp +++ b/test.lisp @@ -6,14 +6,28 @@ `(eval-when-compile (%compile-defmacro ',name (lambda ,args ,@body)))))) +(defmacro defvar (name value) + `(progn + (eval-when-compile + (%compile-defvar ',name)) + (setq ,name ,value))) + (defmacro defun (name args &rest body) `(progn (eval-when-compile (%compile-defun ',name)) (fsetq ,name (lambda ,args ,@body)))) +(defun = (x y) (= x y)) +(defun + (x y) (+ x y)) +(defun - (x y) (- x y)) +(defun * (x y) (* x y)) +(defun / (x y) (/ x y)) (defun 1+ (x) (+ x 1)) (defun 1- (x) (- x 1)) +(defun cons (x y ) (cons x y)) +(defun car (x) (car x)) +(defun cdr (x) (cdr x)) (defun append (list1 list2) (if (null list1) @@ -35,6 +49,7 @@ (cons (funcall func (car list)) (mapcar func (cdr list))))) + ;;; Tests (lambda (x y) x)