This commit is contained in:
Kyle 2015-04-15 08:58:41 -07:00
parent 2e4476b36a
commit e593414598
2 changed files with 20 additions and 4 deletions

View File

@ -101,12 +101,17 @@ string, it will be used as the class's docstring."
:accessor (mksymb name #\- slot)))
,docstring
,@body))
(defun ,ctor (&key ,@(append (inherited-slots supers)
slots))
(make-instance (find-class ,name t nil)
,@(flatten (build-arg-list all-slots))))
t)))
(defun zip (&rest lsts)
"Zip together elements from each list: (zip '(a b c) '(1 2 3))
produces '((a 1) (b 2) (c 3))."
(labels ((zip-acc (lsts)
(unless (some #'null lsts)
(cons (mapcar #'car lsts) (zip-acc (mapcar #'cdr lsts))))))
(zip-acc lsts)))
;;; hash-table functions.
@ -188,4 +193,14 @@ value :b, and :c stores the value :d.
m))
(defun copy-hash-table (ht)
(let ((copied (make-hash-table :equal #'equal)))
(maphash (lambda (k v)
(sethash k v copied))
ht)
copied))
;; (defun ,ctor (&key ,@(append (inherited-slots supers)
;; slots))
;; (make-instance (find-class ,name t nil)
;; ,@(flatten (build-arg-list all-slots))))

View File

@ -15,6 +15,7 @@
#:mksymb
#:mkkw
#:defclass!
#:zip
#:enable-hash-table-reader
#:hashkeys
#:sethash