I've been getting some cryptic error messages from the following block
of code with CMUCL 18d

(in-package "COMMON-LISP-USER")

(defmacro setassoc (key new-element alist &key (test #'eq))
  `(let* ((new-element ,new-element)
          (old-assoc (assoc ,key ,alist :test ,test)))

        (if old-assoc (setf ,alist (delete old-assoc ,alist :test ,test)))
        (push (list ,key new-element) ,alist)))

(defun bletch (job time first-calls)
  (setassoc job time first-calls))

CMUCL complains 

In: DEFUN BLETCH
  (SETASSOC JOB TIME FIRST-CALLS)
--> LET* IF SETF SETQ DELETE 
==>
  #<Function EQ {1000A3F9}>
Error: Cannot dump objects of type (FUNCTION (T T) (MEMBER T NIL)) into fasl files.

--> LET* IF SETF SETQ 
==>
  (DELETE OLD-ASSOC FIRST-CALLS :TEST #<Function EQ {1000A3F9}>)
Note: The fourth argument never returns a value.

--> LET* ASSOC 
==>
  #<Function EQ {1000A3F9}>
Error: Cannot dump objects of type (FUNCTION (T T) (MEMBER T NIL)) into fasl files.

--> LET* 
==>
  (ASSOC JOB FIRST-CALLS :TEST #<Function EQ {1000A3F9}>)
Note: The fourth argument never returns a value.

Converted BLETCH.

File: /home/rpg/circa/d-circa/csm/test-cmucl.lisp

In: DEFUN BLETCH
  (SETASSOC JOB TIME FIRST-CALLS)
--> LET* PUSH SETQ CONS LIST 
==>
  JOB
Note: Deleting unreachable code.

--> LET* IF SETF SETQ DELETE 
==>
  FIRST-CALLS
Note: Deleting unreachable code.

Compiling DEFUN BLETCH: 
Byte Compiling Top-Level Form: 

Compilation unit finished.
  2 errors
  4 notes

The above code is certainly inelegant (LET* seems unnecessary, instead
of LET, IF could be WHEN, etc.), but doesn't seem obviously buggy.  As
far as I know it works fine in Allegro CL, but CMULISP doesn't like it
at all.

Interestingly, the SETASSOC macro is fine when I enter it in a REPL,
but doesn't compile.  I'm afraid I don't have a clue why the compiler
seems to hate #'eq so much.

[At least this time I had the sense to fire up a fresh CMUCL and just
try to compile this file!]

R

Reply via email to