返回指定长度的斐波那契数列
Write a function which returns the first X fibonacci numbers.
还是递归
(fn d
([x] (d x '(1 1)))
([x y]
(let [rev (reverse y)
a (first rev)
b (second rev)
c (+ a b)
n (reverse (conj (reverse y) c))
]
(if (> x 3)
(d (dec x) n)
n
)
)))
返回指定长度的斐波那契数列
Write a function which returns the first X fibonacci numbers.
还是递归
(fn d
([x] (d x '(1 1)))
([x y]
(let [rev (reverse y)
a (first rev)
b (second rev)
c (+ a b)
n (reverse (conj (reverse y) c))
]
(if (> x 3)
(d (dec x) n)
n
)
)))