Paste: aoc1
Author: | yotes |
Mode: | factor |
Date: | Fri, 2 Dec 2022 00:55:50 |
Plain Text |
SYMBOL: inputs-path
"work" resource-path "aoc/inputs/" append-path inputs-path set-global
: get-day-input ( day -- text )
number>string "day" prepend ".txt" append
inputs-path get prepend-path
utf8 file-lines ;
: day1 ( -- result )
1 get-day-input
[ empty? ] split-when
[ [ string>number ] map
sum ] map
[ >=< ] sort ;
: day1-part1 ( -- result )
day1 first ;
: day1-part2 ( -- result )
day1 first3 + + ;
New Annotation