|
|
@ -23,13 +23,7 @@ |
|
|
|
(reduce (cdr list) reducer (reducer current (car list))))) |
|
|
|
(reduce (cdr list) reducer (reducer current (car list))))) |
|
|
|
|
|
|
|
|
|
|
|
(define (combine a b combiner) |
|
|
|
(define (combine a b combiner) |
|
|
|
(if |
|
|
|
(if (null? a) b (if (null? b) a (combiner a b)))) |
|
|
|
(null? a) |
|
|
|
|
|
|
|
b |
|
|
|
|
|
|
|
(if |
|
|
|
|
|
|
|
(null? b) |
|
|
|
|
|
|
|
a |
|
|
|
|
|
|
|
(combiner a b)))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
|
|
|
|
|
|
|
@ -50,8 +44,7 @@ |
|
|
|
(combine |
|
|
|
(combine |
|
|
|
current |
|
|
|
current |
|
|
|
accumulator |
|
|
|
accumulator |
|
|
|
(lambda (current rest) |
|
|
|
(lambda (current rest) (cons (car current) (cdr rest))))) |
|
|
|
(cons (car current) (cdr rest))))) |
|
|
|
|
|
|
|
'())) |
|
|
|
'())) |
|
|
|
|
|
|
|
|
|
|
|
(define (solve-line line) |
|
|
|
(define (solve-line line) |
|
|
|