Game of Life using functional javascript