Hi Mike,

> Here are my results: http://pb1n.de/?ce28f3
> ===
> $ pil t1.l +
> 1.997 sec
> 0.000 sec

Hmm, function 'f' is not correct:

   (de f (N)
      (tco (N A B)
         (let A 0  B 1
            (if (=0 N)
               A
               (tc (dec N) B (+ A B)) ) ) ) )

It always returns zero:

   : (for N 9 (printsp (f N)))
   0 0 0 0 0 0 0 0 0 -> 0


Better is:

   (de f (N)
      (let (A 0  B 1)
         (tco (N A B)
            (if (=0 N)
               A
               (tc (dec N) B (+ A B)) ) ) ) )

   : (for N 9 (printsp (f N)))
   1 1 2 3 5 8 13 21 34 -> 34

: (bench (fibo 36))
1.224 sec
-> 14930352
: (bench (f 36))
0.000 sec
-> 14930352

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to