Programming Language Theory: Difference between revisions

Line 84: Line 84:
* <tt>false ≡ λa. λb. b</tt>
* <tt>false ≡ λa. λb. b</tt>
Using them, we implement basic conditional logic:
Using them, we implement basic conditional logic:
* <tt>test ≡ λa. λb. λc. a b c</tt> (use <tt>true</tt>/<tt>false</tt> for A. Evaluates to B on <tt>true</tt>, C on <tt>false</tt>)
* <tt>test ≡ λa. λb. λc. a b c</tt> (using <tt>true</tt>/<tt>false</tt> for a, <tt>test</tt> reduces to <tt>b</tt> on <tt>true</tt>, and <tt>c</tt> on <tt>false</tt>)
* <tt>not ≡ λt. t false true</tt> (β-equivalent to <tt>test(A, false, true)</tt>)
* <tt>not ≡ λt. t false true</tt> (β-equivalent to <tt>test(A, false, true)</tt>)