Open nhamblet opened 4 years ago
@justinhj, who's video prompted me to write this up, kindly offered that "The purpose of the coflatMap is to let you look at the entire "enlarged" dataset at once", arguing somewhat for not worrying about using extract
.
I've coded up another version where now one can implement the game for any comonad where there's a definition of neighbors. If the "step" functions had known how to access grid coordinates, changing the structure would mean a change in a few places, but now changing the structure would sorta only require changing the comonad instance.
In the readme, I call out a question about using
extract
in the step where you evaluate a cell's neighbors values. Basically, inlifeStep(pg: PointedGrid[Boolean]): Boolean
, should that method know how to access thePointedGrid
internalgrid
, or since that's what theComonad
'sextract
does, should we rely on that instead?In my initial version, I decided to use extract, but playing with both and understanding what they allow, and which chunk of code has which responsibilities would be fun.