414 |
|
|
415 |
;;; Miscelleneous: length, append, concatenate, reverse, zip & count |
;;; Miscelleneous: length, append, concatenate, reverse, zip & count |
416 |
|
|
|
(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))))))))) |
|
|
|
|
417 |
(define (append-reverse rev-head tail) |
(define (append-reverse rev-head tail) |
418 |
(let lp ((l rev-head) (acc tail)) |
(let lp ((l rev-head) (acc tail)) |
419 |
(if (null? l) |
(if (null? l) |