git.fiddlerwoaroof.com
Browse code

add initform to define-collection

fiddlerwoaroof authored on 15/08/2017 01:34:26
Showing 1 changed files
... ...
@@ -35,10 +35,10 @@
35 35
 
36 36
 ; TODO: actually use item-class...
37 37
 ; TODO: finish initform handling.  Have to figure out how to make initform work with push-item
38
-(defmacro define-collection ((name item-class &key (initform '(list))) (&rest supers) &body ((&rest slots) &rest other-stuff))
38
+(defmacro define-collection ((name item-class &key (initarg :items) (initform '(list))) (&rest supers) &body ((&rest slots) &rest other-stuff))
39 39
   (with-gensyms (item-slot-sym)
40 40
     `(progn (defclass ,name (,@supers collection)
41
-              ((,item-slot-sym :initform ,initform :accessor items)
41
+              ((,item-slot-sym :initarg ,initarg :initform ,initform :accessor items) ;
42 42
                ,@slots)
43 43
               ,@other-stuff)
44 44
             (defmethod duplicate-collection ((collection ,name))