Unlambda: Difference between revisions

Content deleted Content added
no variables
m Original built-in functions: remove article reference
Line 15:
Other important features provided by Unlambda include the <code>k</code> and <code>s</code> functions. <code>k</code> manufactures constant functions: the result of <code>`k''x''</code> is a function which, when invoked, returns ''x''. Thus the value of <code>``k''xy''</code> is ''x'' for any ''x'' and ''y''.
 
<code>s</code> is a generalized evaluation operator. <code>```s''xyz''</code> evaluates to <code>``''xz''`''yz''</code> for any ''x'', ''y'', and ''z''. It is a remarkable fact that <code>s</code> and <code>k</code> are sufficient to perform any calculation;, seeas thedescribed in [[SKI combinator calculus]] article for full details. As a brief example, note that the identity function <code>i</code> can be implemented as <code>``skk</code>, since <code>```skk''x''</code> yields ''x'' for all ''x''.
 
Unlambda's one flow control construction is [[call with current continuation]], denoted <code>c</code>. When an expression of the form <code>`c''x''</code> is evaluated, a special "continuation" object is constructed, representing the state of the interpreter at that moment. Then ''x'' 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 <code>`c''x''</code> expression is the same as the value of ''x''. But if the continuation object is applied to a value ''y'', execution of ''x'' is immediately aborted, and the value of the entire <code>`c''x''</code> expression is ''y''.