Skip to content

Instantly share code, notes, and snippets.

@ninjudd
Created May 29, 2012 22:14
Show Gist options
  • Select an option

  • Save ninjudd/2831128 to your computer and use it in GitHub Desktop.

Select an option

Save ninjudd/2831128 to your computer and use it in GitHub Desktop.
--- a/src/clj_gedcom/core.clj
+++ b/src/clj_gedcom/core.clj
@@ -67,9 +67,9 @@
"Parses GEDCOM records from a file or reader, returning map of labels to records."
[in]
(reduce (fn [records record]
- (let [label (:label record)]
- (when (contains? records label)
- (throw (Exception. (format "duplicate record in GEDCOM for label %s" label))))
- (assoc records label record)))
+ (let [id (or (:label record) (:tag record))]
+ (when (contains? records id)
+ (throw (Exception. (format "duplicate record in GEDCOM for %s" id))))
+ (assoc records id record)))
{}
(parse-gedcom-records in)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment