Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your function is always returning <code>'()</code>, I think (can't be sure since you didn't show the whole thing).</p> <p>Perhaps:</p> <pre><code>(defun delete-bindings! (var symbol-table) (cond ((endp symbol-table) '()) ((eql var (caar symbol-table)) (delete-bindings! var (cdr symbol-table))) (t (progn (setf (cdr symbol-table) (delete-bindings! var (cdr symbol-table))) symbol-table))) </code></pre> <p>Addendum:</p> <p>You must use the result of this function, not simply depend on its side effects:</p> <pre><code>(setq *bindings* (delete-bindings! 'var *bindings*)) </code></pre> <p>Second addendum</p> <pre><code>Loading ~/ccl-init.lisp Welcome to Clozure Common Lisp Version 1.7-dev-r14406M-trunk (DarwinX8632)! ? (defun delete-bindings! (var symbol-table) (cond ((endp symbol-table) '()) ((eql var (caar symbol-table)) (delete-bindings! var (cdr symbol-table))) (t (progn (setf (cdr symbol-table) (delete-bindings! var (cdr symbol-table))) symbol-table)))) DELETE-BINDINGS! ? (delete-bindings! 'a '((a . 3) (b . 2))) ((B . 2)) ? </code></pre> <p>If you need a data structure that may be destructively modified with all references to it updated, you'll need another level of indirection.</p> <p>E.g.,</p> <pre><code>(defvar *symbol-table* (cons 'bindings '((a . 3) (b . 2)))) (defun delete-bindings! (var symbol-table) (flet ((db! (var symbol-table) (cond ((endp symbol-table) '()) ((eql var (caar symbol-table)) (delete-bindings! var (cdr symbol-table))) (t (progn (setf (cdr symbol-table) (delete-bindings! var (cdr symbol-table))) symbol-table))))) (rplacd symbol-table (db! var (cdr symbol-table))))) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload