USING: advent kernel arrays sequences sequences.extras math math.parser math.vectors ascii grouping strings formatting ; IN: advent.day10 number [ + ] when* ] accumulate nip ; : (strengths) ( seq -- n ) { 20 60 100 140 180 220 } swap [ dup 1 v-n ] dip nths v* sum ; PRIVATE> : day10-part1 ( -- seq ) (input) (compute) (strengths) ; : day10-part2 ( -- ) (input) (compute) [ 40 mod - abs 1 <= CHAR: # CHAR: . ? ] map-index 40 [ >string "%s\n" printf ] each ;