Guest User

Untitled

a guest
Jan 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. (defn logistic [x r n]
  2. (loop [x x
  3. n n
  4. xs []]
  5. (if (= n 0) xs
  6. (recur (* r x (- 1 x))
  7. (dec n)
  8. (conj xs x)))))
  9.  
  10.  
  11. (defn logistic-rec [x r n]
  12. (_logistic-rec x r n []))
  13.  
  14. (defn _logistic-rec [x r n acc]
  15. (if (= n 0) acc
  16. (let [new-x (* r x (- 1 x))]
  17. (_logistic-rec new-x r (dec n) (conj acc x)))))
Add Comment
Please, Sign In to add comment