;;; Functions are stored in a collection read from the environment with the ;;; function FUNCTIONS, for instance (ACCESS FUNCTION-NAME (FUNCTIONS ENV)). (defmethod env:fdefinition ((client virtual-client) (env virtual-run-time-environment) function-name) (check-type function-name function-name) (cond ((access function-name (functions env))) ((alx:when-let ((def (access function-name (macro-functions env)))) (list 'cl:macro-function def))) ((alx:when-let ((def (access function-name (special-operators env)))) (list 'cl:special def))) (t (error 'undefined-function :name function-name)))) (defmethod env:function-cell ((client virtual-client) (env virtual-run-time-environment) function-name) (check-type function-name function-name) ;; In CDR we store lambda, so the undefined-function signalling function is ;; always EQ for the same FUNCTION-NAME and ENVIRONMENT. (let ((cell (ensure function-name (function-cells env) (cons nil (lambda (&rest args) (declare (ignore args)) (error 'undefined-function :name function-name)))))) (setf (car cell) (or (access function-name (functions env)) (cdr cell))) cell))