Skip to content

Instantly share code, notes, and snippets.

Created June 4, 2010 12:24
What would you like to do?
(definterface IntToIntFn
(#^int call [^int n]))
(def fibr
(let [one (int 1)
two (int 2)]
(call [this n]
(if (>= one n) one (+ (.call this (dec n)) (.call this (- n two))))))))
(def fibr
(call [this n]
(if (>= (int 1) n) (int 1) (+ (.call this (dec n)) (.call this (- n (int 2))))))))
Copy link

(definterface IFib
(^int fib [^int n]))

(deftype Fib []
(fib [this n](if %28>= %28int 1%29 n%29 %28int 1%29 %28+ %28.fib this %28dec n%29%29 %28.fib this %28- n %28int 2%29%29%29%29)))

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