USING: io.backend io.encodings.utf8 io.files kernel math.parser sequences sorting splitting ; IN: advent-of-code.day-01 : get-input-one ( -- file ) "vocab:advent-of-code/day-01/_input/one.txt" normalize-path utf8 file-lines ; : compute-sums ( seq -- seq ) [ dec> ] map [ not ] split-when [ sum ] map ; : solve-problem-one ( -- solution ) get-input-one compute-sums supremum ; : last3 ( seq -- seq ) 3 tail* ; : solution-problem-two ( -- solution ) get-input-one compute-sums natural-sort last3 sum ;