Re: [stack] the concatenative wikipedia article

Robbert Dalen <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
My (very broad) definition would be:

'A concatenative language is a language wherein syntactically valid  
expressions can be concatenated to yield syntactically valid  
expressions.'

For instance, this definition includes all of the following (postfix)  
expressions to be concatenative:

1
1 2
1 2 +
+
3 +
3 4 +

(and with a postfix concatenation of +):

1 2 + 3 4 + + == 10

the latter are all valid syntactic expressions, but may be not  
*semantically* valid, depending on the specific concatenative language  
in question.

Postfix, prefix or infix doesn't really matter for a language to be  
concatenative or not.

For instance, it is perfectly ok for prefix expressions to be  
concatenative:

1
1 2
+ 1 2
+
+ 3
+ 3 4

(and with a prefix concatenation of +):

+ + 1 2 + 3 4 = 10

infix expressions:

1
1 +
1 + 2

4
+ 4
3 + 4

(and with an infix concatenation of +):

1 + 2 + 3 + 4 == 10

Moreover, I think the 'concatenative languages are non-applicative'  
argument is mood:
It is perfectly ok - and convenient  - to have (postfix,prefix,infix)  
lambdas. Here are three different expressions that swap 1 and 2:

postfix: 1 2 {x y=y x} == 1 {x=2 x} == 2 1
prefix: {x y=y x} 1 2 == {y=y 1} 2 == 2 1
infix1: 1 {x y=y x} 2 == 1 {x=2 x} == 2 1
infix2: 1 {x y=y x} 2 == {y=y 1} 2 == 2 1

Here, {...} constructs are anonymous, (partially applied) functions  
which can be concatenated to other expressions, just as any other  
primitive function.
However, only in the infix case the application order is needs to be  
defined - either left-to-right or right-to-left - but that's it.

- robbert


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.