Created
July 28, 2010 17:38
-
-
Save raek/495481 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 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