about summary refs log tree commit diff
path: root/users/sterni/exercises/aoc/lib.bqn
blob: e870a5dfa4260656118e5ccfe185865cc7b3bc4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 ⇐ (¬⊸∧∨∧⟜¬)