I would use 3 records:
(defrecord DownNode []
SomeInterfaceApplicableToDownState
(wake-up [_] (->WaitingNode))
...
InterfaceApplicableToAllNodes
...)
(defrecord WaitingNode []
SomeInterfaceApplicableToWaitingState
(shutdown [_] (->DownNode))
(execute [_ job-id] (->RunningNode job-
AFAIK the only thing that records do not support compared to StructMaps is
namespaced keyword lookup, i.e. (:some-ns/a-key a-record).
If you do not need this, you should consider using records.
Las
On Tue, Mar 25, 2014 at 4:52 PM, Moritz Ulrich wrote:
> The data type created by defstruct isn't
The data type created by defstruct isn't anything more than a map
which can store the specified fields a bit more efficient than
'normal' maps. You can just `assoc' any other key-value pairs as in
any other map.
Also, have a look at records - I think StructMaps have been deprecated
(or at least ar