Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Complex function
(ns user
(:require [clj-time.core :as t]))
(defn- merge-time
[start m]
(apply hash-map (reduce concat (map (fn [x] [x (merge (x m) {:time (/ (t/in-millis (t/interval start (t/now))) 1000)})]) (keys m)))))
(def data {:first {:message "First message"
:success true}
:second {:message "Second message"
:success true}})
(merge-time (t/minus (t/now) (t/millis 150)) data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment