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:31-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/copy.lisp

    r3457 r3460  
    5858                (slot-value object slot-name))))
    5959      (apply #'reinitialize-instance copy initargs))))
     60
     61#|
     62;; A stripped-down version of shallow copy
     63;; Source: http://stackoverflow.com/questions/11067899/is-there-a-generic-method-for-cloning-clos-objects
     64(defun shallow-copy-object (original)
     65  (let* ((class (class-of original))
     66         (copy (allocate-instance class)))
     67    (dolist (slot (mapcar #'slot-definition-name (class-slots class)))
     68      (when (slot-boundp original slot)
     69        (setf (slot-value copy slot)
     70              (slot-value original slot))))
     71    copy))
     72|#
Note: See TracChangeset for help on using the changeset viewer.