Skip to content

Instantly share code, notes, and snippets.

@raek
Created July 28, 2010 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raek/495481 to your computer and use it in GitHub Desktop.
Save raek/495481 to your computer and use it in GitHub Desktop.
(defn parse-divs [divs]
(loop [divs divs,
date nil,
time nil,
result []]
(if (empty? divs)
(seq result)
(let [{:keys [type, content], :as div} (first divs)]
(condp = type
:date (recur (rest divs) content time result)
:time (recur (rest divs) date content result)
(recur (rest divs) date time
(conj result (assoc div
:date date
:time time))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment