close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Ignore:
Timestamp:
2015-09-05T09:45:08-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/ring.lisp

    r3440 r3458  
    6363           "SCALAR-COEFF"
    6464           "INSERT-ITEM"
    65            "APPEND-ITEM"
    66            "COPY-INSTANCE")
     65           "APPEND-ITEM")
    6766  (:shadowing-import-from
    6867   #+openmcl-native-threads #:ccl
     
    233232(defgeneric append-item (self item))
    234233
    235 ;; Source: http://stackoverflow.com/questions/11067899/is-there-a-generic-method-for-cloning-clos-objects
    236 ;; NOTE: This is a shallow copy. Add an around method for classes which need deep copy of the slots.
    237 (defgeneric copy-instance (object &rest initargs &key &allow-other-keys)
    238   (:method ((object cons) &rest initargs &key &allow-other-keys)
    239     (copy-seq object))
    240   (:documentation "Makes and returns a shallow copy of OBJECT.
    241 
    242   An uninitialized object of the same class as OBJECT is allocated by
    243   calling ALLOCATE-INSTANCE.  For all slots returned by
    244   CLASS-SLOTS, the returned object has the
    245   same slot values and slot-unbound status as OBJECT.
    246 
    247   REINITIALIZE-INSTANCE is called to update the copy with INITARGS.")
    248   (:method ((object standard-object) &rest initargs &key &allow-other-keys)
    249     (let* ((class (class-of object))
    250            (copy (allocate-instance class)))
    251       (dolist (slot-name (mapcar #'slot-definition-name (class-slots class)))
    252         (when (slot-boundp object slot-name)
    253           (setf (slot-value copy slot-name)
    254                 (slot-value object slot-name))))
    255       (apply #'reinitialize-instance copy initargs))))
    256234
    257235#|
Note: See TracChangeset for help on using the changeset viewer.