Warning: Parameter 3 to processSchemeCodeTag() expected to be a reference, value given in /Users/gambit/Sites/wiki/includes/parser/Parser.php on line 3333
Script:Math:fib.scm - Gambit wiki

Script:Math:fib.scm

From Gambit wiki

(Difference between revisions)
Jump to: navigation, search
(Script:Math:fib.scm)
m (Reverted edits by Feeley (talk) to last revision by WikiSysop)
 
Line 1: Line 1:
-
<schemecode>;;; Math:fib.scm
+
<schemecode>;; Math:fib.scm
;;
;;
;; Author: Marc Feeley <feeley@iro.umontreal.ca>
;; Author: Marc Feeley <feeley@iro.umontreal.ca>
Line 8: Line 8:
   (if (< n 2)
   (if (< n 2)
       n
       n
-
       (+ (fib (- n 1))
+
       (+ (fib (- n 1)) (fib (- n 2)))))
-
        (fib (- n 2)))))
+
(repl-eval "(time (fib 25))\n")</schemecode>
(repl-eval "(time (fib 25))\n")</schemecode>

Latest revision as of 20:09, 29 September 2011

Personal tools
documentation