Plaster
New
List
Login
common-lisp
default
anonymous
2020.08.03 16:29:29
;;; 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))
Raw
Annotate
Repaste
Edit
Annotations
common-lisp
default
anonymous
2020.08.03 16:38:27
(defmethod (setf env:fdefinition) (new-value (client virtual-client) (env virtual-run-time-environment) function-name) (check-type function-name function-name) (check-type new-value function) (when (access function-name (special-operators env)) (error "~s already names a special operator." function-name)) (unbound function-name (macro-functions env)) (update new-value function-name (functions env)))
Raw
Repaste
Edit