commit 6125fca4d298c4f21fa5505a959e617b4b33ac8b parent e97353b1c5f8e6e25c383ade83b9af6fd39c6ea6 Author: mpizzzle <m@michaelpercival.xyz> Date: Tue, 7 Dec 2021 12:56:15 +0000 reduced 3 passes into 1 (preparing for scan for part 2) Diffstat:
| M | 2021/puzzle_2.apl | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/2021/puzzle_2.apl b/2021/puzzle_2.apl @@ -2,7 +2,8 @@ input← ⎕FIO[49] 'files/2.txt' -c← { +/⍺ { 1 ⍴ (⍺ = ⍵) × ⍎⍵[⍴ ⍵] } ¨ ⍵ } -('f' c input) × (('d' c input) - ('u' c input)) ⍝ part 1 +x← { +/⍵ { 1 ⍴ (⍺ = ⍵) × ⍎⍵[⍴ ⍵] } ¨ input } ¨ 'fdu' + +x[1] × (x[2] - x[3]) ⍝ part 1 )OFF