From e00f7fcd5165cc864bd914e3d68132a949ce712a Mon Sep 17 00:00:00 2001 From: aprzn Date: Fri, 1 Dec 2023 17:46:00 -0500 Subject: [PATCH] day 1! --- .gitignore | 1 + day01.ua | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitignore create mode 100644 day01.ua 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. +/+