-
-
Save lamp/d9719b4a7363f308ea5835f8091e1038 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 add-statuses [instalments effective-date] | |
(map (fn [current previous] | |
(assoc current :status (cond | |
(<= (:due-date current) effective-date) :due | |
(<= (:due-date previous) effective-date) :open | |
:else :scheduled))) | |
(partition 2 1 [{:due-date 0}] instalments))) | |
vs | |
(defn add-statuses [instalments effective-date] | |
(map (fn [current previous] | |
(assoc current :status (cond | |
(<= (:due-date current) effective-date) :due | |
(<= (:due-date previous) effective-date) :open | |
:else :scheduled))) | |
instalments | |
(concat [{:due-date 0}] instalments ))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment