From: David Vazquez Date: Mon, 17 Dec 2012 00:05:31 +0000 (+0000) Subject: 1+, 1-, mapcar X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=4ad36a3415efc56d1348f9c705b6c436ed488a3f;p=jscl.git 1+, 1-, mapcar --- diff --git a/test.lisp b/test.lisp index f63710a..2f4dd35 100644 --- a/test.lisp +++ b/test.lisp @@ -12,6 +12,9 @@ (%compile-defun ',name)) (fsetq ,name (lambda ,args ,@body)))) +(defun 1+ (x) (+ x 1)) +(defun 1- (x) (- x 1)) + (defun append (list1 list2) (if (null list1) list2 @@ -26,7 +29,11 @@ (defun reverse (list) (reverse-aux list '())) -(debug (reverse '(1 2 3 4))) +(defun mapcar (func list) + (if (null list) + '() + (cons (funcall func (car list)) + (mapcar func (cdr list))))) ;;; Tests