Skip to content

Instantly share code, notes, and snippets.

@mprokopov
Created December 29, 2016 11:36
Show Gist options
  • Save mprokopov/8d837713bf18193ec3c76c638c74bc3c to your computer and use it in GitHub Desktop.
Save mprokopov/8d837713bf18193ec3c76c638c74bc3c to your computer and use it in GitHub Desktop.
treading macro with partial for placement argument for func as second
(defn assign-durations [{:keys [resolve_at resolved_at response_at responded_at] :as v}]
(-> v
(assign-duration [response_at responded_at] :response-left)
(assign-duration [resolve_at resolved_at] :resolve-left)))
;; assign-duration
(-> (first (select tickets (where {:id 25029})))
(select-keys [ :resolve_at :resolved_at :responded_at :response_at :resolve-left :response-left])
(select-keys [:resolve_at :resolved_at])
vals
vec
((partial assign-duration {}) :response-left))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment