[stack] Re: Concatenative versus Compositionality
"Don Groves" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], Robbert van Dalen <robbert.van.dalen@...> wrote: > > > But what about postfix notation, i.e. the operator always comes after > the operands? Hi all, In an effort to discover exactly what's meant by the term "concatenative," I offer the following description of a language I think all of us would call concatenative: A program (or function) is a mapping from stacks to stacks such that, (S)[P] -> (S') where P is a program and S, S' are stack contents. A program is represented as an ordered sequence of terms which is evaluated from left to right according to these two rules: 1 - Literal terms are pushed onto the stack. For example: ()[8] -> (8) ()[[1 2]] -> ([1 2]) ()['name] -> (name) 2 - Named terms are executed according to their definitions: (8)[dup *] -> (8 8)[*] -> (64) ()["Hello!" put] -> ("Hello!")[put] -> () with Hello! output. Now, exactly why is this language concatenative? Is it because of the stacks? Is it because of the "ordered sequence of terms?" Is it because of right-associative notation? Is it something else? Is it all of the above? Is this example insufficient? IMHO, answering this question is required for the definition to be useful. -- Don