
5 May
2008
5 May
'08
11:07 a.m.
PR Stanley wrote:
To put it another way, why doesn't the interpreter identify the more specific cases and put them before the general ones.
I'm guessing because determining which equation is the "most general" is equivilent to the Halting Problem in the general case. (Notice that Mathematica does almost exactly the same thing: it has a few heuristics for figuring out what is more general, but beyond that it uses the order you specify.) As to how function application is actually implemented - well, that depends on what you're using to run your Haskell. ;-) I believe GHC uses pointer blocks rather than switch blocks (loosely speaking).