about summary refs log tree commit diff
path: root/users/sterni/exercises/aoc/lib.bqn
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-12-01T12·41+0100
committersterni <sternenseemann@systemli.org>2022-12-01T23·38+0000
commit6abea467e2023a63e3413317c90409d11175f9a9 (patch)
treee16d1aaf1d8765b6c20ed27455a27ee07f6e02f9 /users/sterni/exercises/aoc/lib.bqn
parent6fd9792240fe3797477e31a209743440718932aa (diff)
chore(sterni/exercises/aoc): split out utils into a library of sorts r/5362
Change-Id: Id2bb764fcdcd4b345eed6a98e0d67fcb18fc1353
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7488
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users/sterni/exercises/aoc/lib.bqn')
-rw-r--r--users/sterni/exercises/aoc/lib.bqn8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/sterni/exercises/aoc/lib.bqn b/users/sterni/exercises/aoc/lib.bqn
new file mode 100644
index 000000000000..025102b7760b
--- /dev/null
+++ b/users/sterni/exercises/aoc/lib.bqn
@@ -0,0 +1,8 @@
+IsAsciiNum ⇐ ('0'⊸≤∧≤⟜'9')
+
+ReadInt ⇐ {(𝕨⊸×+⊣)´∘⌽-⟜'0'𝕩} # stolen from leah2
+ReadDec ⇐ 10⊸ReadInt
+
+SplitOn ⇐ ((⊢ (-1˙)⍟⊣¨ +`∘(1⊸»<⊢))∘(≡¨)⊔⊢)
+
+_fix ⇐ {𝕩 𝕊∘⊢⍟≢ 𝔽 𝕩}