4 ms·
I really enjoyed this article. It's great to learn more about groups having been aware of nice properties like closure and identity when designing new data typ
by davexunit 11y ago
I really enjoyed this article. It's great to learn more about groups having been aware of nice properties like closure and identity when designing new data types and the procedures that operate on them. While it doesn't discuss group theory explicitly, SICP's section 2.2 does a great job showing the power of closure.
https://sarabander.github.io/sicp/html/2_002e2.xhtml#g_t2_002e2 https://sarabander.github.io/sicp/html/2_002e2.xhtml#g_t2_00...
- js8 11y agoI think invertible functions and groups are sadly missing from the current functional programming paradigm. Two ideas that I would love to see fleshed out: 1. If compiler would know which function is invertible, it could automatically build inverses of composed functions. And for instance, you could pattern match on a function argument, and it would automatically do the inversion for you! 2. Knowing that some operator is a group operator could lead to efficient optimizations. Consider a collection over which you calculate a folded value, where the folding is a group operator. Then knowing that, you could use group element inverse to recalculate the value when the collection changes, instead of recalculating it over the whole collection. Example: You need to keep a sum of list of numbers. Since addition is group operator, removing elements could cause the sum to be recalculated via subtraction of the single element.
- dllthomas 11y agoThis is explored some in Haskell in a couple places. One I remember off the top of my head: https://hackage.haskell.org/package/lens-4.13/docs/Control-Lens-Iso.html#g:2 https://hackage.haskell.org/package/lens-4.13/docs/Control-L...