3 ms·
I thought this was going to be about the "fix" function in Haskell.
by bbcbasic 11y ago
I thought this was going to be about the "fix" function in Haskell.
- wz1000 11y agoAlso known as the Y Combinator :P
- pflanze 11y agoThe Haskell implementation is not the Y combinator. But it's one way to implement the fixed-point combinator (and it is functionally equivalent): https://en.wikipedia.org/wiki/Fixed-point_combinator https://en.wikipedia.org/wiki/Fixed-point_combinator Edit: The difference is that the Haskell implementation (http://hackage.haskell.org/package/base-4.8.1.0/docs/src/Data.Function.html#fix http://hackage.haskell.org/package/base-4.8.1.0/docs/src/Dat...): fix f = let x = f x in x relies on recursive let. The Y combinator instead works in the lambda calculus which does not have recursion, and it instead relies on recombining the function for each application.
- agumonkey 11y agoI am fascinated by fixed points and quines and their relationships.
- pflanze 11y agoInteresting, I didn't think of quines since I learned about and played with the fixed-point combinators. I never wrote a quine, I guess that's why. I'll try some time.
- agumonkey 11y agoArticles about derivation of quines and fixed points often start with their infinite expansion nature, and then imagine a way to build a meta level replicator. The Y combinator is mostly that, duplicates the function to make recursive, with a functional parameter protocol to pass it to its sibling self. Only my newb view.
- bbcbasic 11y agoWhen I see fix, foldl, etc. as an imperative programmer I get uneasy and think 'what is the computer actually doing?!'. I need to see example thunks.
- pflanze 11y agoI might post something in the +-near future.