Created
April 18, 2010 00:52
-
-
Save mikedouglas/369928 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- index | |
[coll] | |
(map vector (iterate inc 0) coll)) | |
(defn- pos | |
[elm coll] | |
(for [[i e] (index coll) :when (e elm)] i)) | |
(defn convert | |
"Convert the results of `live` into intervals." | |
[in] | |
(let [temps (union-all in)] | |
(for [t temps] | |
(let [found (pos t in) | |
reg (if (keyword? (:id t)) (:id t))] | |
{:id t, :start (first found), :end (last found), :reg reg})))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment