Thanks for getting back to me. I was beginning to wonder which of the 5 ways to interpret the silence :) I think it must be in the genes: (
http://en.wikipedia.org/wiki/Warnock's_Dilemma)
Anyway, here is what
I've got:
(
defmodel cargo-hold ()
(ship-owner capacity
;; a set of cargo-types
(types :cell t :
initarg :types
:
initform nil)
;; cargo-type -> quantity
(quantities :cell t :
initarg :quantities
:
initform (make-hash-table))))
(
defmodel cargo ()
;; a type-id, name and the number of
;; cargo-hold units it takes up (1-3)
(type name volume
;; the character-id of the owner of
;; the cargo-hold unless cargo is spaced
(holder :cell t :
initarg :holder
:
initform (c-in nil) :
accessor holder)
(
auth-list :cell t :
initarg :
auth-list
:
initform nil :
accessor
auth-list)
(recipient :cell t :
initarg :recipient
:
initform nil :
accessor recipient)
(stolen :cell t :
initarg :stolen
:
initform (c? (when (member (^holder)
(^
auth-list))
t))
:
accessor stolen)
(spaced :cell t :
initarg :spaced
:
initform (c? (when holder t))
:
accessor spaced)
(delivered :cell t :
initarg :delivered
:
initform (c? (when (
eql (^holder)
(^recipient))
t))
:
accessor delivered)))
The first thing you'll probably notice is that there is no mechanism for the cargo-holds to actually "contain" cargo objects. I know I could do as the "summer" example of the cell-basics doc does, and push them onto a list, and recalculate based on the whole list every time it changes, but
I was hoping for something more elegant and efficient. Only one entry in the quantities hash needs to change when an item is added for instance. I thought of having in and out slots (set the slot to a cargo object to add or remove; the other slots do their thing and then clear the in/out slot), but that seems ugly and I wasn't even sure how to pull it off.
And then there is the whole thing with cargo-sets which is closer to what I'd like to do with Cells on the larger scale. Basically what I want is to have a large number of sets and their unions/intersections efficiently accessible anywhere in my code- stuff like "all characters of faction X in sector Y carrying at least one Z in their cargo hold.
I hope this makes my level of understanding more clear. I think I'm probably more prepared for the paradigm shift than most, owing, no doubt, to my long infatuation with Ted Nelson's
ZigZag.
~Michael
Warnock
Guild Software Inc.