about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-12-15T23·44+0100
committersterni <sternenseemann@systemli.org>2021-12-15T23·58+0000
commit3f8c99f5c33632b0e69bc3334793eabf847c48f8 (patch)
tree7450578b0415e1e08887026f5e58c62744d73d3b
parent0f5cc25697b3d43f64ed2914e186cecee75efce7 (diff)
refactor(sterni/aoc/2021): fold over 2d array instead of nested list r/3262
Seems to save some allocations and thus recover some performance
compared to the two separate folds we had before.

Change-Id: Ie3d283103e6a9b8aa702db633d9c988fda1b2903
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4348
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
-rwxr-xr-xusers/sterni/exercises/aoc/2021/solutions.bqn2
1 files changed, 1 insertions, 1 deletions
diff --git a/users/sterni/exercises/aoc/2021/solutions.bqn b/users/sterni/exercises/aoc/2021/solutions.bqn
index 443dd61a01a4..47e858cff588 100755
--- a/users/sterni/exercises/aoc/2021/solutions.bqn
+++ b/users/sterni/exercises/aoc/2021/solutions.bqn
@@ -239,7 +239,7 @@ day13Folds ← ParseFolds 1 ⊑ day13Input
 
 PerformAllFolds ← {𝕩 {(𝕨 _Fold)´𝕩}˜´ ⌽𝕨}
 DotMatrix ← {
-  ⟨width, height⟩ ← 1+⌈´𝕩
+  ⟨width, height⟩ ← 1+⌈˝∘‿2⥊∾𝕩
   {𝕩? '█';' '}¨ height‿width⥊≠¨⊔((⊣+(width⊸×)∘⊢)´)¨ 𝕩
 }