diff options
author | sterni <sternenseemann@systemli.org> | 2021-12-14T00·13+0100 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-12-14T13·41+0000 |
commit | c7ebb34f8f105688a963944505b28d5a8a699d6f (patch) | |
tree | f86ba5844ab36101c28ac9748844a1b075f29167 /users/sterni | |
parent | 6842e25f14a463d0f7e7ad7d9ebe700a7efabb7a (diff) |
refactor(sterni/aoc/2021): use a fold instead of last scan element r/3238
We can use the reverse swap trick to get a forward fold. Change-Id: I88185e2ff0b41ec1454f414db2d24b1c8173ac2d
Diffstat (limited to 'users/sterni')
-rwxr-xr-x | users/sterni/exercises/aoc/2021/solutions.bqn | 2 |
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 1810fc316b4b..443dd61a01a4 100755 --- a/users/sterni/exercises/aoc/2021/solutions.bqn +++ b/users/sterni/exercises/aoc/2021/solutions.bqn @@ -237,7 +237,7 @@ day13Folds ← ParseFolds 1 ⊑ day13Input # part 2 -PerformAllFolds ← {(-1)⊸⊑(<𝕩) {(𝕨 _Fold)´𝕩}` 𝕨} +PerformAllFolds ← {𝕩 {(𝕨 _Fold)´𝕩}˜´ ⌽𝕨} DotMatrix ← { ⟨width, height⟩ ← 1+⌈´𝕩 {𝕩? '█';' '}¨ height‿width⥊≠¨⊔((⊣+(width⊸×)∘⊢)´)¨ 𝕩 |