mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
fixing bug in iota when start/step given
This commit is contained in:
parent
6fb2d4cf21
commit
372aabb636
1 changed files with 1 additions and 1 deletions
|
@ -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))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue