"Strong typing vs. strong testing"
Paul Rubin
no.email at nospam.invalid
Fri Oct 1 22:44:11 EDT 2010
More information about the Python-list mailing list
Fri Oct 1 22:44:11 EDT 2010
- Previous message (by thread): "Strong typing vs. strong testing"
- Next message (by thread): "Strong typing vs. strong testing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Raffael Cavallaro <raffaelcavallaro at pas.despam.s.il.vous.plait.mac.com> writes: > CL-USER 119 > (defun fib (n) > (/ (loop for k from 1 to n by 2 > sum (/ (* (expt 5 (/ (1- k) 2)) (fact n)) > (fact k) (fact (- n k)))) > (expt 2 (1- n)))) > CL-USER 122 > (time (fib 1000)) > Timing the evaluation of (FIB 1000) > 43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875 I have no idea what that fancy algorithm is doing, but the number it prints appears to be the 2000th Fibonacci number rather than the 1000th. And it took 0.76 seconds even compiled. This Haskell code took no perceptible time even in the ghci interpreter: main = print (fib 0 1 !! 2000) where fib a b = a:(a+b):fib b (a+b)
- Previous message (by thread): "Strong typing vs. strong testing"
- Next message (by thread): "Strong typing vs. strong testing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list