Day 1 part 1, fixed

main
Araozu 2023-12-02 19:35:25 -05:00
parent b9932ddbfe
commit ecd5ff63ed
1 changed files with 8 additions and 6 deletions

View File

@ -64,16 +64,18 @@
(string->number (string first-char last-char)))) (string->number (string first-char last-char))))
; Read file
(define file-contents
(port->string (open-input-file "input-01.txt") #:close? #t))
; Split file into list of strings
(define input (string-split file-contents "\n"))
; process
(define char-list (map string->list input)) (define char-list (map string->list input))
(define result (foldl + 0 (map list->digits char-list))) (define result (foldl + 0 (map list->digits char-list)))
(define file-contents
(port->string (open-input-file "input-01.txt") #:close? #t))
(print result)
; (print result)