TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
The Algebra of Data, and the Calculus of Mutation
12 points
by
perplexes
about 15 years ago
1 comment
fexl
about 15 years ago
Beautiful. I suppose the function signatures would be:<p><pre><code> peek : int * int^3 -> int pos : int * int^3 -> 3*int^2 poke : int * 3*int^2 -> int^3 </code></pre> The functions would behave like this:<p><pre><code> peek 2 (98,76,54) = 76 pos 2 (98,76,54) = (98,_,54) poke 77 (98,_,54) = (98,77,54) </code></pre> You could chain them like this:<p><pre><code> poke 99 (pos 1 (98,76,54)) = (99,76,54) poke 77 (pos 2 (98,76,54)) = (98,77,54) poke 55 (pos 3 (98,76,54)) = (98,76,55)</code></pre>