Created
January 20, 2019 04:30
-
-
Save hierophantos/c7972c48514a63d2e997d2ee41eb8a20 to your computer and use it in GitHub Desktop.
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
(defn logistic [x r n] | |
(loop [x x | |
n n | |
xs []] | |
(if (= n 0) xs | |
(recur (* r x (- 1 x)) | |
(dec n) | |
(conj xs x))))) | |
(defn logistic-rec [x r n] | |
(_logistic-rec x r n [])) | |
(defn _logistic-rec [x r n acc] | |
(if (= n 0) acc | |
(let [new-x (* r x (- 1 x))] | |
(_logistic-rec new-x r (dec n) (conj acc x))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment