News for hackers. Stuff that matters.
Re:Out of the Tar Pit (2006) [pdf] by bts on Tuesday February 28, 2023 @06:07PM (#34976215)
You should look into the "comonad" abstraction from the functional programming world. Dual to monads, they're a natural fit for situations where you might have a value with some sort of (possibly infinite) context (think: neighborhood, or history, etc.) that can be either pre-computed or computed on-demand.

This StackOverflow post[1] is a good starting point for understanding comonads. It points out that they can be used to model cellular automata (like Conway's Game of Life), sequences, streams, etc.

[1] https://stackoverflow.com/questions/8428554/what-is-the-como...

Re:Out of the Tar Pit (2006) [pdf] by cloogshicer on Wednesday March 01, 2023 @03:51AM (#34980189)
Thank you very much, I'll look into that!