USING: ascii grouping io.encodings.ascii io.files kernel literals math prettyprint sequences sets ; IN: aoc2022.day03 CONSTANT: input $[ "vocab:aoc2022/day03/input.txt" ascii file-lines ] : priority-sum-by ( ... seq quot: ( ... seq -- ... newseq ) -- ... n ) '[ @ first dup letter? 96 38 ? - ] map-sum ; inline : part1 ( -- ) input [ halves intersect ] priority-sum-by . ; : part2 ( -- ) input 3 [ intersect-all ] priority-sum-by . ; : day03 ( -- ) part1 part2 ; MAIN: day03