aeberts

Clojure Fib

Apr 17th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn fiber [n]
  2.   "Produces a fibonacci sequence from 0 to n"
  3.   (loop [result []]
  4.     (if (zero? n)
  5.       (conj result 0)
  6.       (do
  7.         (conj result (+ (- n 1) (- n 2)))
  8.         (recur (dec n))))))
Advertisement
Add Comment
Please, Sign In to add comment