picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 4341994fd4dfee4abee60c10afde5656f0929084
parent 62f41763e522ae80c72eec6f138c44f4786a5282
Author: Alexander Burger <abu@software-lab.de>
Date:   Sat, 27 Oct 2012 10:34:00 +0200

Changed 'fibo' definitions to a more "standard" form
Diffstat:
Mmisc/fibo.l | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/misc/fibo.l b/misc/fibo.l @@ -1,9 +1,9 @@ -# 10jul11abu +# 27oct12abu # (c) Software Lab. Alexander Burger # Standard version (de fibo (N) - (if (> 2 N) + (if (>= 2 N) 1 (+ (fibo (dec N)) (fibo (- N 2))) ) ) @@ -11,7 +11,7 @@ # Parallelized version (de fibo+ (D N) # Uses 2**D processes (cond - ((> 1 (dec 'N)) 1) + ((>= 1 (dec 'N)) 1) ((ge0 (dec 'D)) (let (A NIL B NIL) (later 'A (fibo+ D N)) @@ -27,7 +27,7 @@ # Using a cache (fastest) (de cachedFibo (N) (cache '(NIL) (pack (char (hash N)) N) - (if (> 2 N) + (if (>= 2 N) 1 (+ (cachedFibo (dec N)) (cachedFibo (- N 2))) ) ) ) @@ -41,7 +41,7 @@ (cFibo (N) "Fibo" 'I N) ) int Fibo(int n) { - if (n < 2) + if (n <= 2) return 1; return Fibo(n-1) + Fibo(n-2); }