1.rkt 440 B

12345678910111213141516
  1. #lang racket
  2. (require "../lib/utils.rkt")
  3. (define fp (open-input-file "input"))
  4. (define lines (get-lines fp))
  5. (define (extract-number line)
  6. (define number-list (filter char-numeric? (string->list line)))
  7. (set! number-list (map (λ (c)
  8. (string->number (list->string (list c))))
  9. number-list))
  10. (+ (last number-list) (* 10 (car number-list))))
  11. (apply + (map extract-number lines))