diff options
author | sterni <sternenseemann@systemli.org> | 2022-12-06T08·39+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-12-06T14·45+0000 |
commit | 17e0a74e7b8eda6cdaeb0a6240738eb32356fcb1 (patch) | |
tree | 412e4cf4fc12b9370648c10556ed67b3c6e36829 /users/sterni | |
parent | efbac0813c6bfb17e6620bc4a8f52eb94812bb92 (diff) |
refactor(sterni/aoc/2022/05): improve parsing a bit r/5395
By taking advantage of filling (ironically) we can avoid creating a spec in an ugly way. Additionally we transpose before parsing which doesn't really make all that much of a difference, though. Change-Id: Ida593138654f8367d666447f2b62013e8ddff01e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7535 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'users/sterni')
-rw-r--r-- | users/sterni/exercises/aoc/2022/05/5.bqn | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/users/sterni/exercises/aoc/2022/05/5.bqn b/users/sterni/exercises/aoc/2022/05/5.bqn index bca18c1f63c2..b3d190b9fc77 100644 --- a/users/sterni/exercises/aoc/2022/05/5.bqn +++ b/users/sterni/exercises/aoc/2022/05/5.bqn @@ -3,8 +3,7 @@ rs‿rc ← (<"") SplitOn •FLines "../05/input" stacks ← { count ← '0'-˜⊑⌽' ' (≠/⊢) ⊑⌽rs - spec ← 0<(-1)↓(-1)⌽∾(∾⟜0‿0‿0)¨1+↕count - ' ' (≠/⊢)¨⥊⋈˘⍉>spec⊸/¨(-1)↓rs + ' ' (≠/⊢)¨⥊⋈˘ (count×4) ((»∘(0⊸=)∘(4⊸|)∘↕⊣)/↑) ⍉> (-1)↓rs } cmds ← {0‿1‿1-˜ ReadDec¨ ((∧´IsAsciiNum)¨/⊢) (<' ') SplitOn 𝕩}¨ rc |