TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Algebra of Data, and the Calculus of Mutation

12 pointsby perplexesabout 15 years ago

1 comment

fexlabout 15 years ago
Beautiful. I suppose the function signatures would be:<p><pre><code> peek : int * int^3 -&#62; int pos : int * int^3 -&#62; 3*int^2 poke : int * 3*int^2 -&#62; 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>