11 lines
329 B
BQN
11 lines
329 B
BQN
# a‿b Sub x: the b-length subarray starting at a
|
||
Sub ⇐ {a‿b𝕊𝕩:b↑a↓𝕩}
|
||
|
||
# e Split xs: split xs on occurrences of e (default 0)
|
||
Split ⇐ {Sub⟜𝕩¨ ((1+») ⋈¨ ⊢-») /(𝕨⊣0)=𝕩}
|
||
|
||
Day1 ⇐ {
|
||
sums ← ∨+´¨ Split •BQN⎊0¨ •FLines 𝕩
|
||
⟨⊑sums, +´3↑sums⟩
|
||
}
|
||
•Show Day1 ⊑•args
|