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.bqn6
1 files changed, 5 insertions, 1 deletions
diff --git a/users/sterni/exercises/aoc/lib.bqn b/users/sterni/exercises/aoc/lib.bqn
index 636eeace78d2..172343b41979 100644
--- a/users/sterni/exercises/aoc/lib.bqn
+++ b/users/sterni/exercises/aoc/lib.bqn
@@ -1,6 +1,10 @@
 IsAsciiNum ⇐ ('0'⊸≤∧≤⟜'9')
 
-ReadInt ⇐ {(𝕨⊸×+⊣)´∘⌽-⟜'0'𝕩} # stolen from leah2
+# based on leah2's function
+ReadInt ⇐ {
+  𝕨 𝕊 𝕩: '-'=⊑𝕩? -𝕨 𝕊 1↓𝕩;
+  𝕨 𝕊 𝕩: (𝕨⊸×+⊣)´∘⌽-⟜'0'𝕩
+}
 ReadDec ⇐ 10⊸ReadInt
 
 SplitOn ⇐ ((⊢ (-1˙)⍟⊣¨ +`∘(1⊸»<⊢))∘(≡¨)⊔⊢)