A concatenative programming language is a point-free computer programming language in which all expressions denote functions, and the juxtaposition of expressions denotes function composition.[1] Concatenative programming replaces function application, which is common in other programming styles, with function composition as the default way to build subroutines.
For example, a sequence of operations in an applicative language like the following:
y = foo(x)
z = bar(y)
w = baz(z)
...is written in a concatenative language as a sequence of functions, without parameters:[2]
foo bar baz
Functions and procedures written in concatenative style are not value level, i.e. they typically do not represent the data structures they operate on with explicit names or identifiers; instead they are function level - a function is defined as a pipeline, a sequence of operations that take parameters from an implicit data structure on which all functions operate, and return the function results to that shared structure so that it will be used by the next operator.[3]
The combination of a compositional semantics with a syntax that mirrors such a semantics makes concatenative languages highly amenable to algebraic manipulation of programs;[4] although it may be difficult to write mathematical expressions directly in them.[5] Concatenative languages can be implemented in an efficient way with a stack machine, and are commonly present implicitly in virtual machines in the form of their instruction sets.[5]
The properties of concatenative languages are the result of their compositional syntax and semantics:
The first concatenative programming language was Forth, although Joy was the first language to call itself concatenative. Other concatenative languages are Factor, Onyx, PostScript, and RPL.
Most existing concatenative languages are stack-based; this is not a requirement and other models have been proposed.[9][10][11] Concatenative languages are currently used for embedded, desktop, and web programming, as target languages, and for research purposes.
Most concatenative languages are dynamically typed. Exceptions include the statically typed Cat language.[12]
By: Wikipedia.org
Edited: 2021-06-18 19:24:25
Source: Wikipedia.org