Re: [stack] Why is point-free form so interesting?
Manfred Von Thun <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <C2C168D0.A96%[email protected]> |
On 16/7/07 11:34 AM, "John Carter" <[email protected]> wrote > On Fri, 13 Jul 2007, Christopher Diggins wrote: > >> > snip< Many programming languages don't even bother allowing people to >> specify >> > unordered data because it would introduce new constructs, operations, or >> > representations into their language, thus increasing complexity. >> > > Aha! Here we have the meat of it. > > Yes, having an unorder data type is implementationwise more complex, but > semantically simpler. > > I suspect "unordered set" needs to be a (or the) primitive. > > Arrays and lists are a premature optimization that make reasoning about the > langauge harder as they add spurious information that has to be dealt with. > > Parameters probably should be a set, and a binding should be a map (an > unordered set of pairs). > One criticism of Joy has been that because there are no names for formal parameters inside the definitions of functions, there has to be an arbitrary ordering of the actual parameters which the definition of the function has to know about. If the formal parameters are named, as in f(x,y,z) = ... then the body ... of the definition does not have to know the order of the formals. My response was that the caller of the function needs to know the order (x,y,z) of the formals in the head of the definition so that the actual parameters, say (a+b, c, d*e) are given in the appropriate order. In Joy at least the actual parameters in a call and the formal parameters in the definition are in exactly the same order. I one wanted a language in which there is no arbitrary order, with names for the formals in the definition, then these names should also be used in the calls. So instead of writing f(a+b,c,d*e), one could write any of the following: f(x=a+b,y=c,z=d*e), or f(z=d*e),x=a+b,y=c) or f(y=b,z=d*e,x=a+b) or ... a total of 6 entirely equivalent ways. The same freedom already holds for the formals in the head of the definition. I believe Ada and Common Lisp allow such a notation. Another example are the unix shells sh, csh and their variants. Here the parameters for the utilities have useful and obvious default values. So beginners can use the defaults for a long time without even knowing that this is what they are doing. Only later they learn that one can override the default values by explicitly giving alternative values. If one wants to give explicit values to all parameter, then one can do that in any order. So we seem to have two extremes: The languages of the previous paragraph, and the concatenative languages. In the middle are those notations used by most programming languages. - Manfred [Non-text portions of this message have been removed]