Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 423 Bytes
;; Example 2.36
(define (accumulate op initial seq)
(if (null? seq)
initial
(op (car seq)
(accumulate op initial (cdr seq)))))
(define (accumulate-n op init seqs)
(if (null? (car seqs))
null
(cons (accumulate op init (map car seqs))
(accumulate-n op init (map cdr seqs)))))
(define x (list (list 1 2 3) (list 4 5 6) (list 7 8 9) (list 10 11 12)))
x
(accumulate-n + 0 x)
Jump to Line
Something went wrong with that request. Please try again.