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