Created
December 1, 2016 17:13
-
-
Save lyndsysimon/3d782f875da3dedc67caec76ba26cbf2 to your computer and use it in GitHub Desktop.
Complex function
This file contains hidden or 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
(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