Re: [stack] Is this language concatenative?
John Carter <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 29 Apr 2007, Michael Nedzelsky wrote:
> Consider the following example. Is this language concatenative?
A couple of comments...
* There is the lexical level and the grammatical level, and care must
be taken not to confuse the two. eg. The number token
"-2.1e-10" is not postfix concatenative.
* In Joy [ and ] seem to have a special status. Namely the
concatenative property only seems to work if you treat [ and ] and
everything between a matching pair as a single entity.
* Chris says, "The semantics of a concatenative language are that
each term is a state function (e.g. from a set of stacks to a set
of stacks), and the concatenation of two terms implies the
composition of those functions."
I'm not convinced the word "stack" needs to appear in the
definition at all.
Any fragment of a concatenative language is a function mapping a
set X onto itself. In Joy X is the set of stacks. I'm not convinced
that is the only valid domain for concatenative languages.
I would also hypothesize a family of languages where "string
concatenation represents XXX" where XXX is some other useful
mathematical operation apart from functional composition.
Conversely another family exists where "functional composition is
represented by SOME TRIVIAL OPERATION ON FAMILIAR PRIMITIVE
DATATYPE". eg. List append, tree join...
Of course the whole thing can be generalized in both directions to
create families of languages where "BASIC MATHEMATICAL OPERATIONS
are represented by TRIVIAL OPERATIONS on FAMILIAR PRIMITIVE
DATATYPES".
So one could compile..
* a long list of all basic and interesting mathematical operations
* and there algebraic properties
and then
* another list of primitive datatypes and
* basic operations on those datatypes and
the algebraic properties
and overlay the two wherever the algebras match and create a new language.
And then select from that vast family those languages (that language?) which
affords the greatest simplifications.
The answer may well be "represent functional composition by string
concatenation", ie. Joy.
Ok, so let me distill this wild lateral thinking down a bit....
Question 1:
Is "string concatenation" or "functional composition" or the
representation by one of the other the fundamental thing about
concatenative languages? Or is the broader concept "isomorphisms
between algebras of higher mathematical constructs and algebras of
primitive computer datatypes lead to
(deceptive?|interesting?|useful?) simplifications"
Question 1b :
Can you propose an interesting "non-von thunnian" language (like a
non-euclidean space) where we either....
* Use other primitive datatype / operation instead of strings and
concatenation..
* Or represent some other basic mathematical operation by concatenation.
Candidates I can think of off the top of my head is
* multiplication "ab === a * b"
* convolution
and / or
* operates non-trivially and interestingly on something other than stacks.
Question 2:
Are stacks the only meaningful domain and range for the functions we
are composing?
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand