[Haskell-cafe] Functions are first class values in C
Philippa Cowderoy
flippa at flippac.org
Sat Dec 22 10:25:34 EST 2007
On Sat, 22 Dec 2007, Cristian Baboi wrote:
> On Sat, 22 Dec 2007 17:13:55 +0200, Philippa Cowderoy <flippa at flippac.org>
> wrote:
>
> > Here's a trivial example that does so:
> >
> > (\x -> x) (\x -> x)
> >
> > A lambda calculus classic that doesn't typecheck in Haskell:
> >
> > (\x -> x x) (\x -> x x)
>
> > Feel free to try evaluating it!
>
> Thank you for your message.
>
> I tryed and this is what I've got:
> ERROR - cannot find "show" function for:
> *** Expression : (\x -> x) (\x -> x)
> *** Of type : a -> a
>
Yep, that's because while it can evaluate it down to (\x -> x) your
interpreter doesn't know how to print the result. You can demonstrate that
it works by then passing in something to that result though:
((\x ->x) (\x -> x)) 1
You'll have to evaluate the other one by hand. Don't spend too long with
it though!
--
flippa at flippac.org
"The reason for this is simple yet profound. Equations of the form
x = x are completely useless. All interesting equations are of the
form x = y." -- John C. Baez
More information about the Haskell-Cafe
mailing list