From 2c2833352ee146c9fda294fbf455d6529f8374ee Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 13 Jul 2013 02:02:22 +0200 Subject: Make function references as lazy as necessary. --- sb-eval2.lisp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sb-eval2.lisp') 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) -- cgit v1.2.3