Fix identifier issues in fold-left/fold-right.
This commit is contained in:
parent
b5bfb18961
commit
8a66c759dc
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
(: fold-left (All (c a b ...) ((c a b ... b -> c) c (Listof a) (Listof b) ... b -> c)))
|
(: fold-left (All (c a b ...) ((c a b ... b -> c) c (Listof a) (Listof b) ... b -> c)))
|
||||||
(define (fold-left f c as . bss)
|
(define (fold-left f c as . bss)
|
||||||
(if (or (null? a)
|
(if (or (null? as)
|
||||||
(ormap null? bss))
|
(ormap null? bss))
|
||||||
c
|
c
|
||||||
(apply fold-left f
|
(apply fold-left f
|
||||||
(apply f c (car as) (map car bss))
|
(apply f c (car as) (map car bss))
|
||||||
(cdr as) (map cdr bs))))
|
(cdr as) (map cdr bss))))
|
||||||
|
|
||||||
(: fold-right (All (c a b ...) ((c a b ... b -> c) c (Listof a) (Listof b) ... b -> c)))
|
(: fold-right (All (c a b ...) ((c a b ... b -> c) c (Listof a) (Listof b) ... b -> c)))
|
||||||
(define (fold-right f c as . bss)
|
(define (fold-right f c as . bss)
|
||||||
(if (or (null? a)
|
(if (or (null? as)
|
||||||
(ormap null? bss))
|
(ormap null? bss))
|
||||||
c
|
c
|
||||||
(apply f
|
(apply f
|
||||||
(apply fold-left f c (cdr as) (map cdr bs))
|
(apply fold-left f c (cdr as) (map cdr bss))
|
||||||
(car as) (map car bss))))
|
(car as) (map car bss))))
|
Loading…
Reference in New Issue
Block a user