Paste: AoC 2023 day1 tests

Author: phred
Mode: factor
Date: Tue, 5 Dec 2023 02:06:15
Plain Text |
USING: advent2023 arrays documents.private io.streams.string
kernel sequences splitting tools.test ;
IN: advent-2023.tests


! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! day 1
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
 { "1abc2" 12 }
 { "pqr3stu8vwx" 38 }
 { "a1b2c3d4e5f" 15 }
 { "treb7uchet" 77 }
}
[
  first2
  [ [ .d1-line ] curry ] dip 1array swap unit-test
] each



! part 2
"two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen
twone" split-lines
{ 29 83 13 24 42 14 76 21 }
[
 [ [ .d1.2-line ] curry ] dip 1array swap unit-test
] 2each

New Annotation

Summary:
Author:
Mode:
Body: