1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 01:00:20 +02:00

(length+): Rewrite using scm_ilength.

This commit is contained in:
Kevin Ryde 2003-07-28 23:54:39 +00:00
parent 15d36a3438
commit de51f5955d
3 changed files with 13 additions and 13 deletions

View file

@ -414,19 +414,6 @@
;;; Miscelleneous: length, append, concatenate, reverse, zip & count
(define (length+ clist)
(if (null? clist)
0
(let lp ((hare (cdr clist)) (tortoise clist) (l 1))
(if (null? hare)
l
(let ((hare (cdr hare)))
(if (null? hare)
(+ l 1)
(if (eq? hare tortoise)
#f
(lp (cdr hare) (cdr tortoise) (+ l 2)))))))))
(define (append-reverse rev-head tail)
(let lp ((l rev-head) (acc tail))
(if (null? l)