Paste: aoc1
Author: | erg |
Mode: | factor |
Date: | Thu, 1 Dec 2022 21:32:55 |
Plain Text |
USING: kernel math.parser math.statistics sequences splitting ;
IN: 2022-aoc1
: parse-aoc1 ( string -- seq )
string-lines { "" } split
[ [ string>number ] map-sum ] map ;
: aoc1-1 ( string -- n ) minmax nip ;
: aoc1-2 ( string -- n ) { 0 1 2 } kth-largests sum ;
Author: | erg |
Mode: | factor |
Date: | Thu, 1 Dec 2022 21:37:23 |
Plain Text |
USING: kernel math.parser math.statistics sequences splitting ;
IN: 2022-aoc1
: parse-aoc1 ( string -- seq )
string-lines { "" } split
[ [ string>number ] map-sum ] map ;
: aoc1-1 ( string -- n ) parse-aoc1 minmax nip ;
: aoc1-2 ( string -- n ) parse-aoc1 { 0 1 2 } kth-largests sum ;
New Annotation