Skip to content

Instantly share code, notes, and snippets.

@dodadoa
Last active September 18, 2018 11:22
Show Gist options
  • Select an option

  • Save dodadoa/0450a0a62e3ce64da8f58ab95b10f036 to your computer and use it in GitHub Desktop.

Select an option

Save dodadoa/0450a0a62e3ce64da8f58ab95b10f036 to your computer and use it in GitHub Desktop.
(defn build-new-ds [result ds]
(if (empty? ds)
result
(let [province (get (first ds) :province)
amphoe (get (first ds) :amphoe)
district (get (first ds) :district)]
(if (contains? result province)
(recur
(assoc result province
(assoc (province result) amphoe
(vec (conj (amphoe (province result)) district))))
(next ds))
(recur
(assoc result province { amphoe [district]})
(next ds))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment