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