3 ms·
Yes, sure (defvar *chip*) (defun memory (&optional (chip *chip*)) (chip-memory chip)) Just binding the variable is enough. If you want to hide
by junke 10y ago
Yes, sure
(defvar *chip*)
(defun memory (&optional (chip *chip*))
(chip-memory chip))
Just binding the variable is enough. If you want to hide this variable as an implementation detail, you can use a macro:
(defmacro with-chip (chip &body body)
`(let ((*chip* ,chip))
,@body))
You could also have a symbol-macrolet so that "memory" expands as a call, i.e. "(memory)", but then you would have the same syntax as the above poster wanted to avoid ;-) (except that accesseors already provide setf functions)