Conway's Game of Life in J I have the following code which produces successive generations of Conway's Game of Life:

life =: 3 : '+./ (&gt;(($ y) $ 1);y) *. &gt; =&amp;(+/ (&gt;,{ ;~(1 0 _1))|. y) each 3 4'


Usage:

RR =: 5 7 $ 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0

NB. First five gens of RR
life^:(i.5) RR

NB. in ASCII
' *' {~ life^:(i.5) RR


Explanation of code:

&gt;,{ ;~(1 0 _1)


Produces all possible 1 rotations of a matrix y.

|. y


Applies 1 rotations to y

+/


Adds all 1 rotations leading to neighbor-count for each cell

=&amp;


Creates a monadic function which takes a single number and compares it to the neighbor-counts

each 3 4


Applies the function to 3 and 4 to find cells with 3 or 4 surrounding cells including self alive.

&gt;


Unboxes to apply bitwise and

(&gt;(($ y) $ 1);y)


I want all cells that correspond to 3 (($ y) $ 1) and only the cells that are already currently living the correspond to 4 (y).

+./


Or the result together to produce the next generation.

I would like to know if there's a better way to do this and shorten code. A lot of the things I did seem very hacky.
I have written APL code on VM/CMS and in DEC's VAX-11 interpreter.

No, I don't see a better way that would shorten the code.