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

(append-map, append-map!): Rewrite as simple "apply append" forms, for

tail recursiveness.
This commit is contained in:
Kevin Ryde 2004-12-04 23:13:16 +00:00
parent 890ed2790b
commit 66f0ff4ab9

View file

@ -674,27 +674,10 @@
(define (append-map f clist1 . rest)
(if (null? rest)
(let lp ((l clist1))
(if (null? l)
'()
(append (f (car l)) (lp (cdr l)))))
(let lp ((l (cons clist1 rest)))
(if (any1 null? l)
'()
(append (apply f (map1 car l)) (lp (map1 cdr l)))))))
(apply append (apply map f clist1 rest)))
(define (append-map! f clist1 . rest)
(if (null? rest)
(let lp ((l clist1))
(if (null? l)
'()
(append! (f (car l)) (lp (cdr l)))))
(let lp ((l (cons clist1 rest)))
(if (any1 null? l)
'()
(append! (apply f (map1 car l)) (lp (map1 cdr l)))))))
(apply append! (apply map f clist1 rest)))
(define (map! f list1 . rest)
(if (null? rest)