fixing bug in iota when start/step given

This commit is contained in:
Alex Shinn 2010-01-22 10:50:28 +09:00
parent 6fb2d4cf21
commit 372aabb636

View file

@ -29,7 +29,7 @@
(define (iota count . o)
(let ((start (if (pair? o) (car o) count))
(step (if (and (pair? o) (pair? (cdr o))) (cadr o) 1)))
(let lp ((i count) (n (- start step)) (res '()))
(let lp ((i count) (n (+ start (* (- count 1) step))) (res '()))
(if (<= i 0)
res
(lp (- i 1) (- n step) (cons n res))))))