[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SET method not defined automatically...



>   
>   I meant SETF not SET.
>
>   In the following file, a customized version of defstruct is defined
>but when I use it with MCL 2.0 the SETF methods for each of its slots
>seems not to be defined automatically. This was not the case in MACL 1.3.2.
>
> [Code omitted]

Works fine for me. Please send example forms that illustrate the omission
of the SETF methods.

I have assumed the following definitions for the functions that you did
not include:

-----------------------------------------------------------------------

(defun string-concatenate (&rest strings)
  (apply 'concatenate 'string strings))

(defun mapc-condcons (function list)
  (let ((res nil))
    (dolist (element list)
      (let ((res-el (funcall function element)))
        (when res-el (push element res))))
    (nreverse res)))

(eval-when (:compile-toplevel :execute)

(defmacro sd-slots (sd) `(%svref ,sd 1))

)

(defun structure-slot-names (structure-type)
  (let ((sd (gethash structure-type ccl::%defstructs%))
        res)
    (unless sd
      (error "There is no structure named ~s" structure-type))
    (dolist (slotd (sd-slots sd))
      (let ((slot-name (car slotd)))
        (when (symbolp slot-name)
          (push slot-name res))))
    (nreverse res)))