Created
December 1, 2019 14:12
-
-
Save tzach/e30c92eebc625ae91e3f9c6dba01373c to your computer and use it in GitHub Desktop.
calcInterest
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 round100 [n] (-> n (* 100) (Math/floor) (/ 100))) | |
(defn calcInterest [& {:keys [initialAmount interestRate years roundInterestYearly]}] | |
(nth (iterate | |
(fn calcInterestOneYear [amount] | |
(cond-> (* interestRate amount) | |
roundInterestYearly round100)) | |
initialAmount) years)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reimplementing the Kotlin code from http://www.softwarearchiblog.com/2019/11/code-learner.html in Clojure