Check out the Rosetta Code page on Y Combinator. In many languages that you would not even expect, this functional combinator is simple and straighforward.
For instance, Algol 68!
Haskell? "The obvious definition of the Y combinator in Haskell canot be used because it contains an infinite recursive type (a = a -> b). Defining a data type (Mu) allows this recursion to be broken. "
What kind of a shit functional language doesn't let you define the Y combinator using the obvious definition?
Oh right, the same one in which contortions are required to put items of different types into the same linked list.
Name:
Anonymous2012-02-18 8:36
i only know a little about haskell... what contortions are needed to make a heterogeneous linked list? some kind of pointer/reference type?
Name:
Anonymous2012-02-18 9:08
``faggot''
newtype Mu a = Roll { unroll :: Mu a -> a }
fix :: (a -> a) -> a
fix = \f -> (\x -> f (unroll x x)) $ Roll (\x -> f (unroll x x))
fac :: Integer -> Integer
fac = fix $ \f n -> if (n <= 0) then 1 else n * f (n-1)
fibs :: [Integer]
fibs = fix $ \fbs -> 0 : 1 : fix zipP fbs (tail fbs)
where zipP f (x:xs) (y:ys) = x+y : f xs ys
main = do
print $ map fac [1 .. 20]
print $ take 20 fibs
>>1
ugh. typed-lambda calculus was made with the intention of not admiting thing that can exploit the russel paradox (ie Y combinator) that why it's said the typed lambda calculus is less powerful that untyped one but safer.
tl;dr not haskell fault, it was with that purpose made the typed lamda calculus