One way is to get all the games from the vector.
maybe something like:
(defn game-keys [from] (set (map (fn [x] (:game x)) from)))
Now we have all the unique games that are stored somewhere, now for each of them we want to get the highest start value. Sorting can be useful if we filter out the right games.
(defn games [key from] (filter (fn [x] (= (:game x) key)) from))
So, we can get the games that we need, now we need only the highest of them
(defn max-start [lst] (first (sort (fn [xy] (> (:start x) (:start y))) lst)))
So now we can do:
(map (fn [x] (max-start (games x game-vec))) (game-keys game-vec))
However, this is just one way to do, probably the best ways to do, depending on the definition of the best.
source share