bqn
This commit is contained in:
parent
90c2a52251
commit
601ade63d1
1 changed files with 8 additions and 5 deletions
13
aoc.bqn
13
aoc.bqn
|
@ -2,10 +2,13 @@
|
||||||
Sub ⇐ {a‿b𝕊𝕩:b↑a↓𝕩}
|
Sub ⇐ {a‿b𝕊𝕩:b↑a↓𝕩}
|
||||||
|
|
||||||
# e Split xs: split xs on occurrences of e (default 0)
|
# e Split xs: split xs on occurrences of e (default 0)
|
||||||
Split ⇐ {Sub⟜𝕩¨ ((1+») ⋈¨ ⊢-») /(𝕨⊣0)=𝕩}
|
Split ⇐ {(⊏ ∾ 1⊸↓¨∘(1⊸↓)) Sub⟜𝕩¨ (» ⋈¨ ⊢-») /𝕨=𝕩∾(𝕨⊣⟜0↩)}
|
||||||
|
|
||||||
Day1 ⇐ {
|
Day1 ⇐ (⊑ ⋈ (+´3⊸↑))∘(∨+´¨)∘Split∘(•BQN⎊0¨)∘•FLines
|
||||||
sums ← ∨+´¨ Split •BQN⎊0¨ •FLines 𝕩
|
|
||||||
⟨⊑sums, +´3↑sums⟩
|
Day2 ⇐ {
|
||||||
|
Line ← -⟜"AX"∘∾ ' '⊸Split
|
||||||
|
B ← ⊣ (A ← {1+𝕩+3×3|1+𝕩-𝕨}) {3|𝕨+𝕩-1}
|
||||||
|
+´˘⍉ (A≍B)´∘Line˘ >•FLines 𝕩
|
||||||
}
|
}
|
||||||
•Show Day1 ⊑•args
|
# •Show Day2 ⊑•args
|
||||||
|
|
Loading…
Reference in a new issue