refactor(sterni/aoc/2022/05): improve _ApplyCmd

* take advantage of block header for destructuring

* instead of ModestTake we can split the stack we are picking from into
  what we need to move and what to keep, saving us from having to repeat
  ourselves.

* remove some unnecessary parens

Change-Id: I1b81a93a27d14dcbb6bdd109e862a356f611aca9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7530
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
This commit is contained in:
sterni 2022-12-05 22:40:16 +01:00 committed by clbot
parent 736edce338
commit 3f2172556a

View file

@ -9,11 +9,10 @@ stacks ← {
cmds {011-˜ ReadDec¨ ((´IsAsciiNum)¨/) (<' ') SplitOn 𝕩}¨ rc cmds {011-˜ ReadDec¨ ((´IsAsciiNum)¨/) (<' ') SplitOn 𝕩}¨ rc
ModestTake (<)
_ApplyCmd { _ApplyCmd {
cft 𝕩 s Fn _self cft :
m 𝔽 c ModestTake f𝕨 mk 2 c ((())) fs
(m)(t) (c)(f)𝕨 (Fn m)(t) k˙(f) s
} }
•Out "day05.1: "¨stacks _ApplyCmd˜´ cmds •Out "day05.1: "¨stacks _ApplyCmd˜´ cmds