Function definition: Difference between revisions

Content added Content deleted
imported>Tromp
Line 1,107: Line 1,107:
In lambda calculus, multiplication on Church numerals is <code>mul = \m \n \f. m (n f)</code> which in BLC is
In lambda calculus, multiplication on Church numerals is <code>mul = \m \n \f. m (n f)</code> which in BLC is


<syntaxhighlight>00 00 00 01 1110 01 110 10</syntaxhighlight>
<pre>00 00 00 01 1110 01 110 10</pre>


If mul is used several times within an expression E, then they can share the same definition by using <code>(\mul. E)(\m\n\f. m (n f))</code>. For example, the cube function is <code>\n. (\mul. mul n (mul n n)) (\m\n\f. m (n f))</code> which in BLC is
If mul is used several times within an expression E, then they can share the same definition by using <code>(\mul. E)(\m\n\f. m (n f))</code>. For example, the cube function is <code>\n. (\mul. mul n (mul n n)) (\m\n\f. m (n f))</code> which in BLC is


<syntaxhighlight>00 01 00 01 01 10 110 01 01 10 110 110 0000000111100111010</syntaxhighlight>
<pre>00 01 00 01 01 10 110 01 01 10 110 110 0000000111100111010</pre>


=={{header|BQN}}==
=={{header|BQN}}==