Assume an array of cells with an initial distribution of live and dead cells,
and imaginary cells off the end of the array having fixed values.

Cells in the next generation of the array are calculated based on the value of the cell and its left and right nearest neighbours in the current generation.

If, in the following table, a live cell is represented by 1 and a dead cell by 0 then to generate the value of the cell at a particular index in the array of cellular values you use the following table:

000 -> 0  # 
001 -> 0  #
010 -> 0  # Dies without enough neighbours
011 -> 1  # Needs one neighbour to survive
100 -> 0  #
101 -> 1  # Two neighbours giving birth
110 -> 1  # Needs one neighbour to survive
111 -> 0  # Starved to death.

declare
  A0 = {List.toTuple unit "_###_##_#_#_#_#__#__"}
 
  MaxGenerations = 9
 
  Rules = unit('___':&_
               '__#':&_
               '_#_':&_
               '_##':&#
               '#__':&_
               '#_#':&#
               '##_':&#
               '###':&_)
 
  fun {Evolve A}
     {Record.mapInd A
      fun {$ I V}
         Left = {CondSelect A I-1 &_}
         Right = {CondSelect A I+1 &_}
         Env = {String.toAtom [Left V Right]}
      in
         Rules.Env
      end
     }
  end
 
  fun lazy {Iterate X F}
     X|{Iterate {F X} F}
  end
in
  for
     I in 0..MaxGenerations
     A in {Iterate A0 Evolve}
  do
     {System.showInfo "Gen. "#I#": "#{Record.toList A}}
  end