summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2013-07-13 02:02:22 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2013-07-13 02:02:22 +0200
commit2c2833352ee146c9fda294fbf455d6529f8374ee (patch)
treebb97a1d3614cd439e9286111fc875283ec9f0865
parentd73c24e51435746257d33c6e1e17ed8e7bf9923b (diff)
Make function references as lazy as necessary.
-rw-r--r--sb-eval2.lisp13
1 files changed, 9 insertions, 4 deletions
diff --git a/sb-eval2.lisp b/sb-eval2.lisp
index 8105cd6..0567318 100644
--- a/sb-eval2.lisp
+++ b/sb-eval2.lisp
@@ -182,10 +182,15 @@
(declaim (ftype (function ((or symbol list) list context) eval-closure) prepare-global-call))
(defun prepare-global-call (f args context)
- (let ((f* (fdefinition f))
- (args* (mapcar (lambda (form) (prepare-form form context)) args)))
- (lambda (env)
- (apply f* (mapcar (lambda (x) (funcall (the eval-closure x) env)) args*)))))
+ (let ((args* (mapcar (lambda (form) (prepare-form form context)) args)))
+ (if (fboundp f)
+ (let ((f* (fdefinition f)))
+ (lambda (env)
+ (apply f*
+ (mapcar (lambda (x) (funcall (the eval-closure x) env)) args*))))
+ (lambda (env)
+ (apply (fdefinition f)
+ (mapcar (lambda (x) (funcall (the eval-closure x) env)) args*))))))
(declaim (ftype (function (eval-closure list context) eval-closure) prepare-direct-call))
(defun prepare-direct-call (f args context)