Created
February 3, 2019 04:37
-
-
Save shandanjay/9e036c8c68dc40225492054c12e0689b to your computer and use it in GitHub Desktop.
A Multimethod solution to get the nth item in fibonacci series
This file contains 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
(defmulti fibonacci identity) | |
(defmethod fibonacci 0 [_] 1) | |
(defmethod fibonacci 1 [_] 1) | |
(defmethod fibonacci :default [n] (+ (fibonacci (- n 1) ) (fibonacci (- n 2) )) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment