lisp - Using entities from parent function -
usually obvious use entities of parent function function called within parent function. if have,
(defun fun1(x)(let ((y nil))(fun2))) (defun fun2 () (print y)))
then (fun1 2) complains y. how use entities parent function child function, fun2 able access entities of let scope of f1.
you descritption , code wrong, i'll answer understanding want do.
to such thing need declare
variable special
:
(defun parent-fun (x) (let ((y nil)) (declare (special y)) (child-fun x))) (defun child-fun (x) (declare (special y)) ;; without declatation it'll work `(,x ,y)) ;; you'll warning cl-user> (parent-fun '(a b c)) ((a b c) nil)
Comments
Post a Comment