about summary refs log tree commit diff
path: root/users/sterni/exercises/aoc/lib.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/exercises/aoc/lib.bqn')
-rw-r--r--users/sterni/exercises/aoc/lib.bqn18
1 files changed, 18 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..e870a5dfa426
--- /dev/null
+++ b/users/sterni/exercises/aoc/lib.bqn
@@ -0,0 +1,18 @@
+IsAsciiNum ⇐ ('0'⊸≤∧≤⟜'9')
+IsAlpha ⇐ (('a'⊸≤∧≤⟜'z')∨('A'⊸≤∧≤⟜'Z'))
+
+# based on leah2's function
+ReadInt ⇐ {
+  𝕨 𝕊 𝕩: '-'=⊑𝕩? -𝕨 𝕊 1↓𝕩;
+  𝕨 𝕊 𝕩: (𝕨⊸×+⊣)´∘⌽-⟜'0'𝕩
+}
+ReadDec ⇐ 10⊸ReadInt
+
+SplitOn ⇐ ((⊢ (-1˙)⍟⊣¨ +`∘(1⊸»<⊢))∘(≡¨)⊔⊢)
+SplitAt ← ((⊣≤↕∘≠∘⊢)⊔⊢)
+
+_fix ⇐ {𝕩 𝕊∘⊢⍟≢ 𝔽 𝕩}
+
+ImportBqnLibs ⇐ {•Import 𝕩∾˜"/"∾˜¯1↓1⊑•SH "printenv"‿"BQNLIBS"}
+
+Xor ⇐ (¬⊸∧∨∧⟜¬)