taocp

taocp sandbox.
git clone git://git.ricketyspace.net/taocp.git
Log | Files | Refs

commit a032e8f0d7cfc5d11250bee1b9d81a7ad1e0812e
parent 6995bcd25d64be74f600165ac036ea591054f7bf
Author: rsiddharth <s@ricketyspace.net>
Date:   Thu,  2 Feb 2017 03:42:46 +0000

guile/taocp: Add `fib-fast-range` function

guile/taocp/one/two/eight/fib.scm (fib-fast-range): New function.

Diffstat:
guile/taocp/one/two/eight/fib.scm | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/guile/taocp/one/two/eight/fib.scm b/guile/taocp/one/two/eight/fib.scm @@ -24,6 +24,14 @@ '() (iota 1000 0)))) +(define (fib-fast-range start end) + "Return Fibonacci series between START and END." + (let ((count (1+ (- end start)))) + (reverse (fold (lambda (n prev) + (cons (fib-fast n) prev)) + '() + (iota count start))))) + ;; scheme@(taocp one two eight fib)> (fib-1-1000) ;; $39 = (0.0 1.0 1.0 2.0 3.0 5.0 8.0 13.0 21.0 34.0 54.99999999999999