|
|
@ -44,12 +44,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (is-numeric-char char) (if (char-numeric? char) #t #f)) |
|
|
|
|
|
|
|
|
|
|
|
(define (solve-line line) |
|
|
|
(define (solve-line line) |
|
|
|
( |
|
|
|
( |
|
|
|
(lambda (first-last-result) (string->number (list->string first-last-result))) |
|
|
|
(lambda (first-last-result) (string->number (list->string first-last-result))) |
|
|
|
(first-last |
|
|
|
(first-last (string->list line) is-numeric-char))) |
|
|
|
(string->list line) |
|
|
|
|
|
|
|
(lambda (char) (if (char-numeric? char) #t #f))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (solve-all lines) |
|
|
|
(define (solve-all lines) |
|
|
|
(sum (map lines solve-line))) |
|
|
|
(sum (map lines solve-line))) |
|
|
|