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:
parent
fa5518d1fa
commit
e69cd299ed
1 changed files with 4 additions and 2 deletions
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue