about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-12-05T16·19+0100
committerclbot <clbot@tvl.fyi>2022-12-05T18·58+0000
commit5a41c4c6aa148af716daa77da381bbc318a4a032 (patch)
tree5443d05a7422dd53ff5944c6f28a9ff2dca88b7d
parentee4b95e47072dd52614a4e02958f7aa2dcb10803 (diff)
feat(sterni/aoc/2022): day04 BQN solution r/5391
Very tired today, but seems like a decently tidy solution.

Change-Id: Id3055159ae99e9b91fcc4b9b41ec7fe5e9a1bc6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7528
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
-rw-r--r--users/sterni/exercises/aoc/2022/04/4.bqn11
1 files changed, 11 insertions, 0 deletions
diff --git a/users/sterni/exercises/aoc/2022/04/4.bqn b/users/sterni/exercises/aoc/2022/04/4.bqn
new file mode 100644
index 000000000000..0b8f1b4500a9
--- /dev/null
+++ b/users/sterni/exercises/aoc/2022/04/4.bqn
@@ -0,0 +1,11 @@
+⟨SplitOn, ReadDec⟩ ← •Import "../../lib.bqn"
+
+Sections ← {
+  a‿b ← ReadDec¨ (<'-') SplitOn 𝕩
+  ↕⌾(-⟜a) 1+b
+}
+i ← ∘‿2⥊Sections¨ ∾(<',') SplitOn¨ •FLines "input"
+Is ← ∊´∘((⍋≠¨)⊏⊢)
+
+•Out "day04.1: "∾•Fmt +´(∧´Is)˘ i
+•Out "day04.2: "∾•Fmt +´(∨´Is)˘ i