Created
January 25, 2013 00:09
-
-
Save nlacasse/4630019 to your computer and use it in GitHub Desktop.
insert-resource-node
This file contains hidden or 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 insert-resource-node! | |
[inserter res] | |
(if-let [id (get @id-map res)] | |
; If the resource has aleady been added, just return the id. | |
id | |
; Otherwise, add the node for the node, and remember its id for later. | |
(let [id (.createNode inserter {"resource" res})] | |
(swap! id-map #(assoc! % res id)) | |
id))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment