Re: [q-lang-users] Speeding up Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-04-02 18:02:12
|
Brian Beckman wrote: > Would you be so kind as to give a tiny example of a 'constructor' versus a > 'defined function' to clarify how they're different in the lambda calculus > but not so in TR? My memory of lambda is that it's just the following I should have worded that more carefully. Of course, pure lambda calculus doesn't have constructor symbols (they're emulated using lambdas), but Haskell, ML et al have them. I was actually talking about the constructor discipline in pattern-matching definitions in Haskell et al. In a sense these are just rewriting rules, but there are two different classes of symbols, the defined functions which occur as head symbols in the definitions, and the constructor symbols which occur in the argument patterns. Consequently, in Haskell, ML etc. there's just no way you can write a rule like foo (foo x) = x; expressing the idempotence of a "function" foo, or Bar (Bar x y) z = Bar x (Bar y z); for making a binary "constructor" Bar right-associative. But in TR, these kinds of rules are just normal business. In a sense, these are all just conveniences. After all, lambda calculus is as universal as term rewriting and they can easily emulate each other. But rewriting rules are just *so* much more convenient, otherwise why would there be pattern-matching in virtually every modern FPL (and there's even a Lisp dialect which has them)? TR languages go all they way there, by just abolishing the artificial segregation between functions and constructors. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |