commit e00f7fcd5165cc864bd914e3d68132a949ce712a Author: aprzn Date: Fri Dec 1 17:46:00 2023 -0500 day 1! diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14140f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.in diff --git a/day01.ua b/day01.ua new file mode 100644 index 0000000..d7df02b --- /dev/null +++ b/day01.ua @@ -0,0 +1,38 @@ +PartI ← ( + ▽×⊃(≤@9|≥@0|∘) # digits only + parse⊟⊃(⊢|⊢⇌) # add them together +) + +PartII ← ( + . + ⊐≡⌕⊙¤ {"one" "two" "three" + "four" "five" "six" + "seven" "eight" "nine"} + /+≡×+1⇡9 + ≡((⋅∘|+@0⊙;)>0.) + PartI +) + +$ 1abc2 +$ pqr3stu8vwx +$ a1b2c3d4e5f +$ treb7uchet + +⊜PartI≠@\n. +/+ + +$ two1nine +$ eightwothree +$ abcone2threexyz +$ xtwone3four +$ 4nineeightseven2 +$ zoneight234 +$ 7pqrstsixteen + +⊜PartII≠@\n. +/+ + +&fras "day01.in" + +⊜(⊟⊃(PartI|PartII))≠@\n. +/+