Created
February 10, 2011 21:27
-
-
Save rik0/821384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn -initialize [this params] | |
(dosync | |
(alter (.state this) merge | |
(unpack-parameters | |
params | |
[:is-starting-node :connections-on-spawn :starting-nodes] | |
(array-map :is-starting-node false)))) | |
true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn unpack-parameters | |
([params ks defaults] | |
(merge defaults | |
(apply hash-map | |
(interleave ks params)))) | |
([params defaults] | |
(unpack-parameters params (keys defaults) defaults))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment