Is it possible to generate 40,000+ element of Fibonacci recursively in Lisp?
问题 I'm trying to solve Project Euler question 2 with Lisp. This recursive solution blows the stack on execution, but I thought Lisp (using clisp) would recognize the tail recursion. This is being entered into the top-level. (defun e2-problem (&optional (f1 1) (f2 1) (sum 0)) "Sum fibonacci sequence, even terms up to 4 million" (if (> f2 4000000) sum) (e2-problem f2 (+ f1 f2) (if (evenp f2) (+ sum f2) sum)) Is my implementation not correctly arranged for optimization? I imagine this would hinder