fixed point

Harris, Andrew Andrew.Harris at
Mon Oct 27 09:16:22 EST 2003

> Notice that, (\x -> x) a reduces to a, so (\a b c -> a b c) x (y-z) z
> reduces to x (y-z) z.  You can therefore simplify your 
> function quite a
> bit.
> wierdFunc x y z = if y-z > z then x (y-z) z else (\d e -> d) (y-z) z
> and you can still apply that lambda abstraction (beta-reduce)
> wierdFunc x y z = if y-z > z then x (y-z) z else y-z
> None of these (except, of course, fix and remainder) are recursive.  A
> recursive function is just one that calls itself.  For wierdFunc to be
> recursive, the identifier wierdFunc would have to occur in the
> right-hand side of it's definition.

Thanks for your help.  For some reason I didn't think "x (y - z) z" and "y -
z" had the same type.  I am still trying to understand how they do.  Also,
had a feeling the fix function was related to the "Y" combinator; it seems
they're the same thing!

thanks again,

More information about the Haskell-Cafe mailing list