Content deleted Content added
fixed ambiguity |
Jerryobject (talk | contribs) m WP:REFerence WP:CITations: repeats consolidate-merge as WP:NAMEDREFS, cuts. |
||
(43 intermediate revisions by 33 users not shown) | |||
Line 1:
{{Short description|Type of programming language}}
{{Programming paradigms}}▼
A '''concatenative programming language''' is a [[Point-free programming|point-free]] computer [[programming language]] in which all expressions denote [[Function (mathematics)|functions]], and the [[juxtaposition]] of [[Expression (computer science)|expressions]] denotes [[function composition]].<ref name="dobbscodetalk">{{cite
==Example==
For example, a
<source lang="javascript">▼
...is written in a concatenative language as a sequence of functions, without parameters:<ref>{{cite web | url=http://concatenative.org/wiki/view/Concatenative%20language/Name%20code%20not%20values | title=Name code not values | publisher=Concatenative.org | accessdate=13 September 2013}}</ref>▼
<code>foo bar baz</code>▼
baz(bar(foo(x)))
</syntaxhighlight>
▲...is written in a concatenative language as a sequence of functions
The combination of a compositional [[Semantics of programming languages|semantics]] with a [[Syntax of programming languages|syntax]] that mirrors such a semantics makes concatenative languages highly amenable to algebraic manipulation of programs;<ref>[http://www.latrobe.edu.au/philosophy/phimvt/joy/j00rat.html Rationale for Joy, a functional language]{{dead link|date=July 2013}}</ref> although it may be difficult to write mathematical expressions directly in them.<ref name="whymatters"/> Concatenative languages can be implemented in an efficient way with a [[stack machine]], and are a common strategy to program [[virtual machine]]s. <ref name="whymatters">{{cite web | url=http://evincarofautumn.blogspot.com.es/2012/02/why-concatenative-programming-matters.html | title=Why Concatenative Programming Matters | accessdate=13 September 2013}}</ref>▼
Functions and procedures written in concatenative style are not [[Value-level programming|value level]], i.e., they typically do not represent the data structures they operate on with explicit names or [[Identifier#In computer science|identifiers]]. Instead they are [[Function-level programming|function level]] – a function is defined as a [[pipeline (software)|pipeline]], or 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.<ref>{{cite web |url=http://concatenative.org/wiki/view/Concatenative%20language |title=Concatenative language |publisher=Concatenative.org |access-date=13 September 2013}}</ref>
==Properties==▼
▲The combination of
▲==Properties==
The properties of concatenative languages are the result of their compositional syntax and semantics:
* The reduction of any expression is the simplification of one function to another function; it is never necessary to deal with the application of functions to objects.<ref>
* Any subexpression can be replaced with a name that represents the same subexpression.
* The syntax and semantics of concatenative languages form the algebraic structure of a [[monoid]].<ref>
* Concatenative languages can be made well-suited to an implementation inspired by [[linear logic]] where no [[Garbage (computer science)|garbage]] is ever generated.<ref>{{cite
==Implementations==
The first concatenative programming language was [[Forth (programming language)|Forth]], although [[Joy (programming language)|Joy]] was the first language which was termed concatenative. Other concatenative languages are [[dc (computer program)|dc]], [[Factor (programming language)|Factor]], Onyx, [[PostScript]], [[RPL (programming language)|RPL]], Staapl,<ref name="Staapl">{{cite web |last1=Schouten |first1=Tom (zwizwa) |date=<!-- Undated --> |url=http://zwizwa.be/staapl/ |title=Staapl: Forth on Scheme for Embedded Controllers |website=Zwizwa LLC |access-date=12 August 2025}}</ref> and experimental and discontinued ones including:<!-- Alphabetic order--> Enchilada,<ref name="Enchilada">{{cite web |author1=rapido |author2=NewDave |author3=jacintheford |author4=goren |date=2 January 2024 |url=https://concatenative.org/wiki/view/Enchilada |title=Enchilada |website=Concatenative.org |access-date=12 August 2025}}</ref> Om,<ref name="Om">{{cite web |author1=sparist |date=<!-- Undated --> |url=https://www.om-language.com/ |title=The Om Programming Language |website=Om-language.com |access-date=12 August 2025}}</ref> XY.<ref name="XY">{{cite web |last1=Apter |first1=Stevan |date=2004 |url=http://www.nsl.com/k/xy/xy.htm |title=The Concatenative Language XY |website=no stinking loops |access-date=12 August 2025}}</ref>
Most existing concatenative languages are [[Stack-oriented programming|stack-based]]. This is not required, and other models have been proposed.<ref name="XY"/><ref name="Enchilada"/><ref name="Om"/> Concatenative languages are currently used for [[Embedded system|embedded]],<ref name="Staapl"/> [[Application software|desktop]], and [[Web development|web programming]], as [[Translator (computing)|target languages]], and for research purposes.
Most
==See also==
* [[Function-level programming]]
* [[Homoiconicity]]▼
* [[Stack-oriented programming language]]
* [[Tacit programming]]
▲* [[Homoiconicity]]
==References==
Line 45 ⟶ 43:
==External links==
* [http://www.concatenative.org/
▲{{Programming paradigms navbox}}
{{Types of programming languages}}
{{DEFAULTSORT:Concatenative Programming Language}}
[[Category:Concatenative programming languages| ]]
<!-- Hidden categories below -->
[[Category:Articles with example JavaScript code]]
|