5 ms·
The style is lifted straight from mathematics tradition. It is a closed definition and so it would be syntax error to insert anything between the lines. In Has
by willtim 9y ago
The style is lifted straight from mathematics tradition. It is a closed definition and so it would be syntax error to insert anything between the lines.
In Haskell you could always avoid that style and use the case syntax (or for this example guard syntax) instead. All varieties eventually desugar to a case analysis anyway.
Haskell even added curly braces as an alternate to indentation!
- Someone 9y agoIs it a closed definition? The equivalent in Mathematica would allow one to add things whenever one wants, for example to add definitions for fac for negative integers, or to hard-code the value of fac 100. If clean has a REPL (which I couldn’t easily find out from its web page) I expect it to have that, too.
- willtim 9y agoIn Haskell it certainly is a closed definition, you would get a "multiple declarations" syntax error if you tried to split the definition up. I would assume the same for Clean also. In the Haskell REPL, you would need to enter the definitions together.