Misplaced Pages

Concatenative programming language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 01:23, 26 August 2004 editDanakil (talk | contribs)2,873 editsNo edit summary← Previous edit Revision as of 14:40, 23 September 2004 edit undoRJHall (talk | contribs)Autopatrolled, Pending changes reviewers90,673 editsNo edit summaryNext edit →
Line 1: Line 1:
In '''concatenative''' ]s, the concatenation of appropriate programs denotes the composition of the functions which the programs denote. In '''concatenative''' ]s, the ] of appropriate programs denotes the composition of the ]s which the programs denote. Operations map an input ] into a results stack, and so it is possible to repeatedly concatenate a sequence of operations.


A programming language is concatenative (and not ]) when:

*The elementary well-formed ]s of the language are ] functions of a nameless data stack.
A programming language is concatenative (and not applicative) when:
*The elementary well-formed expressions of the language are monadic functions of a nameless data stack.
*If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed. *If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed.
*If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y. *If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y.



==Examples== ==Examples==
The canonical examples of concatenative programming languages are probably ] and ]. The ] examples of concatenative programming languages are ] and ].
In Joy, the program fragment:

:2 7 +

Pushes "2" then "7" onto the stack. The "+" ] then replaces the stack with a new stack that contains the resulting sum "9".


] contains an exhaustive list of those known to ]. The ] contains an exhaustive list of those known to ].


==External links== ==External links==

Revision as of 14:40, 23 September 2004

In concatenative programming languages, the concatenation of appropriate programs denotes the composition of the functions which the programs denote. Operations map an input stack into a results stack, and so it is possible to repeatedly concatenate a sequence of operations.

A programming language is concatenative (and not applicative) when:

  • The elementary well-formed expressions of the language are monadic functions of a nameless data stack.
  • If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed.
  • If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y.

Examples

The canonical examples of concatenative programming languages are Forth and Joy. In Joy, the program fragment:

2 7 +

Pushes "2" then "7" onto the stack. The "+" operator then replaces the stack with a new stack that contains the resulting sum "9".

The Category:Concatenative programming languages contains an exhaustive list of those known to Misplaced Pages.

External links


This article is a stub. You can help Misplaced Pages by expanding it.