On Sun, Dec 7, 2008 at 3:05 AM, Hans Aberg <span dir="ltr">&lt;<a href="mailto:haberg@math.su.se">haberg@math.su.se</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
One can define operators<br>
 &nbsp;a ^ b := b(a) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Application in inverse.<br>
 &nbsp;(a * b)(x) := b(a(x)) &nbsp;-- Function composition in inverse.<br>
 &nbsp;(a + b)(x) := a(x) * b(x)<br>
 &nbsp;O(x) := I &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Constant function returning identity.<br>
 &nbsp;I(x) := x &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Identity.<br>
and use them to define lambda calculus (suffices with the first four; Church reverses the order of &quot;*&quot;).</blockquote><div><br>The simple elegance of writing this encoding just increased my already infinite love of Haskell by another cardinality.<br>
<br>a .^ b = b a<br>(a .* b) x = b (a x)<br>(a .+ b) x = a x .* b x<br>o x = i<br>i x = x<br><br>toNat x = x (+1) 0<br>fromNat n = foldr (.) id . replicate n<br><br>Luke<br></div></div>