From c7ebb34f8f105688a963944505b28d5a8a699d6f Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 14 Dec 2021 01:13:28 +0100 Subject: refactor(sterni/aoc/2021): use a fold instead of last scan element We can use the reverse swap trick to get a forward fold. Change-Id: I88185e2ff0b41ec1454f414db2d24b1c8173ac2d --- users/sterni/exercises/aoc/2021/solutions.bqn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'users/sterni/exercises/aoc/2021') 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⊸×)∘⊢)´)¨ 𝕩 -- cgit 1.4.1