3 ms·
Whoops, that'd be a parsing error. Thanks for catching that. I think different syntax for data constructors and functions reduces ambiguity and adds to readabi
by bendmorris 16y ago
Whoops, that'd be a parsing error. Thanks for catching that.
I think different syntax for data constructors and functions reduces ambiguity and adds to readability.
- tumult 16y agoOne reason to have separate domains for data and functions is that it allows you to have types. If you start with the presumption that you aren't going to have types, you no longer need to make this distinction. Scotch only goes half-way. For example, I can't do this in Scotch: >> foo(a,b) = a >> foo(bar(a,b),bar(c,d)) = bar(a,c) >> bar(a) = "spaghetti" >> foo("baz","qux") "baz" >> foo(foo(bar("baz","qux"),bar("corge","grault"))) "baz" >> foo(bar("anything"),bar("something")) "spaghetti" Scotch distinguishes between data construction and function application, but the only benefit you get out of it is that you won't get any typing errors. If you are interested by the sort of very powerful pattern matching demonstrated above, check out languages in the family of term rewriting, of which the newest and coolest is Pure, http://code.google.com/p/pure-lang/ http://code.google.com/p/pure-lang/, powered by LLVM with influence from Haskell. It is also dynamically typed (by necessity). Another popular example of term rewriting is the Mathematica language, used in the software package of the same name.
- tumult 16y agoForgot to also add: good job so far, but clean it up so it works with cabal/hackage :)