1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-03 02:36:19 +02:00

* boot-9.scm (iota): replaced by a tail recursive version.

(reverse-iota):  removed.
This commit is contained in:
Mikael Djurfeldt 1999-06-05 05:59:26 +00:00
parent fa5518d1fa
commit e69cd299ed

View file

@ -2802,8 +2802,10 @@
;;; {IOTA functions: generating lists of numbers}
(define (reverse-iota n) (if (> n 0) (cons (1- n) (reverse-iota (1- n))) '()))
(define (iota n) (reverse! (reverse-iota n)))
(define (iota n)
(let loop ((count (1- n)) (result '()))
(if (< count 0) result
(loop (1- count) (cons count result)))))
;;; {While}