CL-REF is a library for mutable, pointer-like references.
We can use REFs to emulate "pass-by-reference" functions.
CL-USER> (defun square (x)
(setf (cl-ref:deref x)
(expt (cl-ref:deref x) 2))
CL-USER> (defvar x (cl-ref:ref 5))
CL-USER> (square x)
; No value
CL-USER> (cl-ref:deref x)
The package exports:
REF : <type> The type of a REF object
: <fn> A function to construct a REF object
REF-P : <fn> Decide if an object is a REF.
DEREF : <fn> Obtain the value referenced by a REF.
We also have a setf function for DEREF.