Created
August 10, 2011 22:02
-
-
Save boxxxie/1138396 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 contains-transaction? [transactions transaction] (contains? transactions (:TransactionID transaction))) | |
(defmulti conj-transaction contains-transaction?) | |
(defmethod conj-transaction true [transactions transaction] | |
(let[id (:TransactionID transaction) | |
transaction-list (get transactions id)] | |
(assoc transactions id (conj transaction-list transaction)))) | |
(defmethod conj-transaction false [transactions transaction] | |
(let [id (:TransactionID transaction)] | |
(assoc transactions id (vector transaction)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment