apl: life Conway via 9-shift toroidal sum (+7 tests, 287/287)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m8s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m8s
This commit is contained in:
@@ -824,6 +824,18 @@
|
||||
((prime-mask (apl-eq (apl-scalar 2) divisor-counts)))
|
||||
(apl-compress prime-mask a))))))))
|
||||
|
||||
(define
|
||||
apl-life-step
|
||||
(fn
|
||||
(board)
|
||||
(let
|
||||
((zero-board (apl-mul board (apl-scalar 0))))
|
||||
(let
|
||||
((sum-board (reduce (fn (acc dr) (reduce (fn (acc2 dc) (apl-add acc2 (apl-rotate-first (apl-scalar dr) (apl-rotate (apl-scalar dc) board)))) acc (list -1 0 1))) zero-board (list -1 0 1))))
|
||||
(apl-or
|
||||
(apl-eq sum-board (apl-scalar 3))
|
||||
(apl-and board (apl-eq sum-board (apl-scalar 4))))))))
|
||||
|
||||
(define
|
||||
apl-reduce
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user