tvl-depot/users/sterni/exercises/aoc/2022/05/5.bqn
sterni 17e0a74e7b refactor(sterni/aoc/2022/05): improve parsing a bit
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
2022-12-06 14:45:48 +00:00

18 lines
614 B
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ReadDec, SplitOn, IsAsciiNum •Import "../../lib.bqn"
rsrc (<"") SplitOn •FLines "../05/input"
stacks {
count '0'-˜' ' (/) rs
' ' (/)¨˘ (count×4) ((»(0=)(4|))/) > (-1)rs
}
cmds {011-˜ ReadDec¨ ((´IsAsciiNum)¨/) (<' ') SplitOn 𝕩}¨ rc
_ApplyCmd {
s Fn _self cft :
mk 2 c ((())) fs
(Fn m)(t) k˙(f) s
}
•Out "day05.1: "¨stacks _ApplyCmd˜´ cmds
•Out "day05.2: "¨stacks _ApplyCmd˜´ cmds