Day 1 part 1, fixed
This commit is contained in:
parent
b9932ddbfe
commit
ecd5ff63ed
14
main.rkt
14
main.rkt
@ -64,16 +64,18 @@
|
||||
(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 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)
|
||||
|
Loading…
Reference in New Issue
Block a user