<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Unlambda</id>
	<title>Unlambda - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Unlambda"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Unlambda&amp;action=history"/>
	<updated>2026-10-06T10:56:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Unlambda&amp;diff=107508&amp;oldid=prev</id>
		<title>imported&gt;CanonNiAWB: /* External links */ Adding {{Template:Esoteric programming languages|}}</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Unlambda&amp;diff=107508&amp;oldid=prev"/>
		<updated>2024-08-11T02:59:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;External links: &lt;/span&gt; Adding {{&lt;a href=&quot;/index.php?title=Template:Esoteric_programming_languages&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:Esoteric programming languages (page does not exist)&quot;&gt;Template:Esoteric programming languages&lt;/a&gt;}}&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Refimprove|date=August 2020}}&lt;br /&gt;
{{short description|Functional programming language}}&lt;br /&gt;
{{Infobox programming language&lt;br /&gt;
| name = Unlambda&lt;br /&gt;
| logo = &amp;lt;!-- (filename only) --&amp;gt;&lt;br /&gt;
| logo caption = &lt;br /&gt;
| screenshot = &amp;lt;!-- (filename only) --&amp;gt;&lt;br /&gt;
| screenshot caption = &lt;br /&gt;
| paradigm = Nearly [[Purely functional programming|pure]] [[Functional programming|functional]]&lt;br /&gt;
| family =  &lt;br /&gt;
| designer = David Madore&lt;br /&gt;
| developer = David Madore&lt;br /&gt;
| released = {{Start date and age|1999|06|28|df=yes}}&lt;br /&gt;
| latest release version = 2.0.0&lt;br /&gt;
| latest release date = {{Start date and age|1999|12|20|df=yes}}&lt;br /&gt;
| latest preview version = &lt;br /&gt;
| latest preview date = &amp;lt;!-- {{Start date and age|YYYY|MM|DD|df=yes}} --&amp;gt;&lt;br /&gt;
| typing = [[Type system|Untyped]]&lt;br /&gt;
| scope = &lt;br /&gt;
| programming language = [[Scheme (programming language)|Scheme]], [[C (programming language)|C]], [[Java (programming language)|Java]]&lt;br /&gt;
| discontinued =&lt;br /&gt;
| platform = &lt;br /&gt;
| operating system = &lt;br /&gt;
| license = [[GNU General Public License|GPL]] 2.0 or later&lt;br /&gt;
| file ext = &lt;br /&gt;
| file format = &amp;lt;!-- or: | file formats = --&amp;gt;&lt;br /&gt;
| website = {{URL|www.madore.org/~david/programs/unlambda}}&lt;br /&gt;
| implementations = &lt;br /&gt;
| dialects = &lt;br /&gt;
| influenced by = &lt;br /&gt;
| influenced = &lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Unlambda&amp;#039;&amp;#039;&amp;#039; is a minimal, &amp;quot;nearly [[Purely functional language|pure]]&amp;quot;&amp;lt;ref name=&amp;quot;chu2006&amp;quot;&amp;gt;{{cite web|work=Good Math, Bad Math (blog)|first=Mark C.|last=Chu-Carroll|date=2006-08-11|title=Friday Pathological Programming: Unlambda, or Programming Without Variables|url=http://scienceblogs.com/goodmath/2006/08/11/friday-pathological-programmin-3/|publisher=ScienceBlogs}}&amp;lt;/ref&amp;gt; [[functional programming language]] invented by David Madore. It is based on [[combinatory logic]], an expression system without the [[Lambda calculus|lambda operator]] or free variables. It relies mainly on two built-in functions (&amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;) and an apply operator (written &amp;lt;code&amp;gt;`&amp;lt;/code&amp;gt;, the [[backquote]] character). These alone make it [[Turing-complete]], but there are also some [[input/output]] (I/O) functions to enable interacting with the user, some shortcut functions, and a [[lazy evaluation]] function. Variables are unsupported.&lt;br /&gt;
&lt;br /&gt;
Unlambda is [[free and open-source software]] distributed under a [[GNU General Public License]] (GPL) 2.0 or later.{{clarify|date=March 2022}}&lt;br /&gt;
&lt;br /&gt;
==Basic principles==&lt;br /&gt;
As an [[esoteric programming language]], Unlambda is meant as a demonstration of very pure functional programming rather than for practical use. Its main feature is the lack of conventional operators and data types&amp;amp;mdash;the only kind of data in the program are one-parameter functions.  Data can nevertheless be simulated with appropriate functions as in the [[lambda calculus]].  Multi-parameter functions can be represented via the method of [[currying]].&lt;br /&gt;
&lt;br /&gt;
Unlambda is based on the principle of [[abstraction elimination]], or the elimination of all saved variables, including functions. As a purely functional language, Unlambda&amp;#039;s functions are [[first-class object]]s, and are the &amp;#039;&amp;#039;only&amp;#039;&amp;#039; such objects.&lt;br /&gt;
&lt;br /&gt;
Here is an implementation of a [[hello world program]] in Unlambda:&amp;lt;ref name=&amp;quot;chu2006&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 `r```````````.H.e.l.l.o. .w.o.r.l.di&lt;br /&gt;
&lt;br /&gt;
==Original built-in functions==&lt;br /&gt;
The notation &amp;lt;code&amp;gt;.&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; denotes a function which takes one argument and returns it unchanged, printing the single character &amp;#039;&amp;#039;x&amp;#039;&amp;#039; as a side effect when it is invoked.  &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; represents the version of the identity function that has no such side effect; it is used here as a dummy argument.  The program &amp;lt;code&amp;gt;`.di&amp;lt;/code&amp;gt; applies the &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;-printing function to a dummy argument of &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;, returning &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; and printing the letter &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt; as a side effect.  Similarly, &amp;lt;code&amp;gt;``.l.di&amp;lt;/code&amp;gt; first applies &amp;lt;code&amp;gt;.l&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.d&amp;lt;/code&amp;gt;, printing the letter &amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt; and returning &amp;lt;code&amp;gt;.d&amp;lt;/code&amp;gt;; this result of &amp;lt;code&amp;gt;.d&amp;lt;/code&amp;gt; is then applied to &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; as in the previous example.  The function &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is [[syntactic sugar]] for the function that prints a newline character.&lt;br /&gt;
&lt;br /&gt;
Other important features provided by Unlambda include the &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; functions.  &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; manufactures constant functions: the result of &amp;lt;code&amp;gt;`k&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is a function which, when invoked, returns &amp;#039;&amp;#039;x&amp;#039;&amp;#039;.  Thus the value of &amp;lt;code&amp;gt;``k&amp;#039;&amp;#039;xy&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is &amp;#039;&amp;#039;x&amp;#039;&amp;#039; for any &amp;#039;&amp;#039;x&amp;#039;&amp;#039; and &amp;#039;&amp;#039;y&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; is a generalized evaluation operator. &amp;lt;code&amp;gt;```s&amp;#039;&amp;#039;xyz&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; evaluates to &amp;lt;code&amp;gt;``&amp;#039;&amp;#039;xz&amp;#039;&amp;#039;`&amp;#039;&amp;#039;yz&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; for any &amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;z&amp;#039;&amp;#039;.  It is a remarkable fact that &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; are sufficient to perform any calculation, as described in [[SKI combinator calculus]].  As a brief example, the identity function &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; can be implemented as &amp;lt;code&amp;gt;``skk&amp;lt;/code&amp;gt;, since &amp;lt;code&amp;gt;```skk&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; yields &amp;#039;&amp;#039;x&amp;#039;&amp;#039; for all &amp;#039;&amp;#039;x&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Unlambda&amp;#039;s one flow control construct is [[call with current continuation]], denoted &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;.  When an expression of the form &amp;lt;code&amp;gt;`c&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is evaluated, a special &amp;#039;&amp;#039;continuation&amp;#039;&amp;#039; object is constructed, representing the state of the interpreter at that moment.  Then &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is evaluated, and then the result is given the continuation object as an argument.  If the continuation is never applied to an argument, the value of the &amp;lt;code&amp;gt;`c&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; expression is the same as the value of &amp;#039;&amp;#039;x&amp;#039;&amp;#039;.  But if the continuation object is applied to a value &amp;#039;&amp;#039;y&amp;#039;&amp;#039;, execution of &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is immediately aborted, and the value of the entire &amp;lt;code&amp;gt;`c&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; expression is &amp;#039;&amp;#039;y&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Unlambda&amp;#039;s execution semantics are normally [[eager evaluation]], but a [[lazy evaluation]] option exists, indicated by the use of the &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt; operator.  Usually, to evaluate an expression of the form &amp;lt;code&amp;gt;`&amp;#039;&amp;#039;xy&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;, unlambda first evaluates &amp;#039;&amp;#039;x&amp;#039;&amp;#039;, then &amp;#039;&amp;#039;y&amp;#039;&amp;#039;, and then applies &amp;#039;&amp;#039;x&amp;#039;&amp;#039; to &amp;#039;&amp;#039;y&amp;#039;&amp;#039;.  However, if &amp;#039;&amp;#039;x&amp;#039;&amp;#039; evaluates to the special value &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, then &amp;#039;&amp;#039;y&amp;#039;&amp;#039; is &amp;#039;&amp;#039;not&amp;#039;&amp;#039; evaluated; instead, the value of the expression &amp;lt;code&amp;gt;`d&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is a special &amp;quot;delayed computation&amp;quot; object, which, when applied to an argument &amp;#039;&amp;#039;z&amp;#039;&amp;#039;, evaluates &amp;#039;&amp;#039;y&amp;#039;&amp;#039;, and then applies its value to &amp;#039;&amp;#039;z&amp;#039;&amp;#039;.  In the absence of side effects, this is exactly the same as &amp;lt;code&amp;gt;`i&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;.  The difference is that &amp;lt;code&amp;gt;`i&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; executes any side effects in &amp;#039;&amp;#039;y&amp;#039;&amp;#039; immediately, whereas &amp;lt;code&amp;gt;`d&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; defers the side effects until the result is applied to another argument.&lt;br /&gt;
&lt;br /&gt;
Unlambda&amp;#039;s next built-in operator is &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt;, which ignores its argument and returns &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt;.  This  feature  is not strictly necessary, since &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; could be implemented as &amp;lt;code&amp;gt;``s`k``s``s`kskk`k``s``s`kskk&amp;lt;/code&amp;gt;, but it is supplied as a convenience.  (This expression above is simply &amp;lt;code&amp;gt;`Yk&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;Y&amp;lt;/code&amp;gt; denotes a [[fixed point combinator]].)&lt;br /&gt;
&lt;br /&gt;
==Version 2 built-in functions==&lt;br /&gt;
More built-ins were introduced in Unlambda version 2. [[Input/output|Input]] is facilitated by operators &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;?&amp;#039;&amp;#039;u&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; is applied to a function &amp;#039;&amp;#039;x&amp;#039;&amp;#039;, a character is read from input, and stored as the &amp;quot;current character&amp;quot;; then &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is applied to &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;. However, if no more characters were available on input, the &amp;#039;&amp;#039;current character&amp;#039;&amp;#039; is left undefined, and &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is applied to &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; instead. When a function &amp;lt;code&amp;gt;?&amp;#039;&amp;#039;u&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is applied to a function &amp;#039;&amp;#039;x&amp;#039;&amp;#039;, the result is the evaluation of &amp;lt;code&amp;gt;`&amp;#039;&amp;#039;x&amp;#039;&amp;#039;i&amp;lt;/code&amp;gt; if the current character is &amp;#039;&amp;#039;u&amp;#039;&amp;#039;, otherwise &amp;lt;code&amp;gt;`&amp;#039;&amp;#039;x&amp;#039;&amp;#039;v&amp;lt;/code&amp;gt; is evaluated.&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;reprint&amp;quot; operator &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;`|&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is evaluated, the function &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is applied to &amp;lt;code&amp;gt;.&amp;#039;&amp;#039;u&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; if &amp;#039;&amp;#039;u&amp;#039;&amp;#039; is the current character, or to &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; if there is no current character.&lt;br /&gt;
&lt;br /&gt;
Finally, there is an exit operator &amp;lt;code&amp;gt;e&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;e&amp;lt;/code&amp;gt; is applied to &amp;#039;&amp;#039;x&amp;#039;&amp;#039;, the execution of the program is terminated, and &amp;#039;&amp;#039;x&amp;#039;&amp;#039; is taken as the result of the program (most of the currently existing interpreters ignore the result anyway).&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Iota and Jot]]&lt;br /&gt;
*[[SKI combinator calculus]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
* Felix-Hernandez Campos (1 April 2002), &amp;#039;&amp;#039;[http://www.cs.unc.edu/~stotts/144/lectures/lect28apr.pdf Lecture 28: More on functional programming]&amp;#039;&amp;#039;, University of North Carolina COMP144&lt;br /&gt;
* {{cite book |url=https://books.google.com/books?id=LlR6__OpAxoC&amp;amp;dq=%22Unlambda%22&amp;amp;pg=PA205 |title=Rubyで作る奇妙なプログラミング言語 |language=Japanese |author=原 悠 (Yutaka Hara)|pages=205–214|isbn=978-4-8399-2784-4|publisher=Tōkyō: Mainichikomyunikēshonzu|year=2008}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*{{Official website|www.madore.org/~david/programs/unlambda}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Esoteric programming languages]]&lt;br /&gt;
[[Category:Functional languages]]&lt;br /&gt;
{{Esoteric programming languages}}&lt;/div&gt;</summary>
		<author><name>imported&gt;CanonNiAWB</name></author>
	</entry>
</feed>