Skip to content

Instantly share code, notes, and snippets.

Last active May 17, 2023 00:43
What would you like to do?
rendezvous with cassidoo challenge: 22.10.02
(ns fib-like
(:require [clojure.test :refer [deftest is]]))
(defn fibber [a b]
(cons a (fibber b (+ a b)))))
(defn fib-like [a b n]
(take n
(fibber a b)))
(deftest fib-like-test
(let [n 5]
(is (= [10 20 30 50 80] (fib-like 10 20 n)))
(is (= [ 3 7 10 17 27] (fib-like 3 7 n)))))
Copy link

Note that this isn't just "fib like", this will actually give you the fibonacci sequence if a and b are both 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment