diff options
Diffstat (limited to 'users/sterni/exercises')
-rwxr-xr-x | users/sterni/exercises/aoc/2021/solutions.bqn | 9 | ||||
-rw-r--r-- | users/sterni/exercises/aoc/lib.bqn | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/users/sterni/exercises/aoc/2021/solutions.bqn b/users/sterni/exercises/aoc/2021/solutions.bqn index 4cedb567f9aa..f7247cadf280 100755 --- a/users/sterni/exercises/aoc/2021/solutions.bqn +++ b/users/sterni/exercises/aoc/2021/solutions.bqn @@ -4,17 +4,10 @@ # Utilities # -IsAsciiNum ← ('0'⊸≤∧≤⟜'9') - -ReadInt ← {(𝕨⊸×+⊣)´∘⌽-⟜'0'𝕩} # stolen from leah2 -ReadDec ← 10⊸ReadInt +⟨IsAsciiNum,ReadInt,ReadDec,SplitOn,_fix⟩ ← •Import •path∾"/../lib.bqn" ReadInput ← {•file.Lines ∾ •path‿"/input/day"‿(•Fmt 𝕩)} -SplitOn ← ((⊢ (-1˙)⍟⊣¨ +`∘(1⊸»<⊢))∘(≡¨)⊔⊢) - -_fix ← {𝕩 𝕊∘⊢⍟≢ 𝔽 𝕩} - # # 2021-12-01 # 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 ⇐ {𝕩 𝕊∘⊢⍟≢ 𝔽 𝕩} |