Re: [stack] the concatenative wikipedia article
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Jan 2, 2009, at 9:20 AM, William Tanksley, Jr wrote:
>> This:
>> (sq b) - 4 * a * c
>> Would be written like this instead:
>> - [sq b, * [4, * [a, c]]]
>
> How is that concatenative? It appears totally applicative. I certainly
> don't see any opportunity for associativity in that example
You're right, there isn't any opportunity for it in that example
because there's no contiguous composition of more than two functions.
Perhaps this is a better example:
a = hd
b = hd tl
c = hd tl tl
hypot = sqrt + [sq a, sq b]
Or, you could do something like this:
sq-top = cons [sq a, tl]
hypot = sqrt + sq swap sq
I don't think it would be reasonable to say this isn't concatenative
just because the average number of contiguous compositions is somewhat
lower than in a stack-based language. They both share the all
properties highlighted on the wikipedia entry-in-progress.
>> If your answer is yes, my problem with that is that we don't impose
>> the same syntactic restrictions on the definition of an applicative
>> language.
>
> We talk about applicative languages here, but the reality is that
> there are many different syntaxes for applicative languages, united in
> common by one syntactic feature: the need for a tree structure.
Applicative languages do not need a tree structure. The combinatory
calculus is applicative and can even be written with a "concatenative"
syntax. Look at Unlambda.
> I think it's proper to define and classify languages in terms of their
> syntax
Agreed, ideally provided another term is available for languages with
the same semantics but a different syntax. Lacking such a term, I
think we lack the capability to talk about an interesting family of
languages. In any case, I have no issue with making the term
"concatenative" have syntactic implications as the Wikipedia entry-in-
progress indicates.
- John