Last active
September 4, 2018 18:56
-
-
Save realgenekim/607bf5b4bdb1364df8cc5f94ee589610 to your computer and use it in GitHub Desktop.
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
(def in ["a" "ibid" "ibid" "b"]) | |
(defn ibid | |
([in] | |
(ibid (vec (first in)) (rest in)) | |
([left right] | |
(println left right) | |
(if (empty? right) | |
; done | |
left | |
; else recurse | |
(if (= "ibid" (first right)) | |
; repeat last left | |
(ibid (conj left (last left)) | |
(rest right) | |
(ibid (conj left (first right)) | |
(rest right)))) | |
(defn fib | |
[n] | |
(if (= 1 n) | |
1 | |
(+ n (fib (dec n)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment