Changeset 3460 for branches/f4grobner/copy.lisp
- Timestamp:
- 2015-09-05T09:45:31-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/copy.lisp
r3457 r3460 58 58 (slot-value object slot-name)))) 59 59 (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.