diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-30 00:21:33 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-30 00:21:33 +0200 |
commit | d30b5e487ccbd85deb385a19e12233a9ef9008e2 (patch) | |
tree | 9c6e8dc9bafbb7629b16c23923a8f6ae65be5968 | |
parent | 9c3236394224167b31eeb402fa78928a0e3eb7fe (diff) |
Add FUNCALL, LAMBDA, and REST.
-rw-r--r-- | defun-1.lisp | 9 | ||||
-rw-r--r-- | list-functions.lisp | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/defun-1.lisp b/defun-1.lisp index 6038e88..49680e6 100644 --- a/defun-1.lisp +++ b/defun-1.lisp @@ -18,3 +18,12 @@ (,env-sym (second ,arg-sym))) (d-b ,lambda-list ,env-sym ,whole-sym ,lambda-sym ,@body))))) + +(%defmacro* lambda (lambda-list . body) + (let ((lambda-sym (gensym))) + `(%lambda ,lambda-sym + (d-b ,lambda-list nil nil ,lambda-sym + ,@body)))) + +(defun funcall (function &rest arguments) + (apply function arguments)) diff --git a/list-functions.lisp b/list-functions.lisp index 2622fac..3660e5e 100644 --- a/list-functions.lisp +++ b/list-functions.lisp @@ -2,7 +2,8 @@ eigthth ninth tenth atom consp listp null rplaca rplacd caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr car cdaaar cdaadr cdaar cdadar cdaddr - cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr)) + cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr + rest)) (%defmacro* pushq args @@ -106,7 +107,7 @@ ;;;;----------------------------------------------------------------- -;;;; FIRST ... TENTH +;;;; FIRST ... TENTH, REST ;;;;----------------------------------------------------------------- (defun first (list) (car list)) @@ -138,6 +139,9 @@ (defun tenth (list) (car (cdddr (cdddr (cdddr list))))) +(defun rest (list) + (cdr list)) + ;;;;----------------------------------------------------------------- ;;;; CONS |