
4 Dec
2010
4 Dec
'10
5:20 p.m.
Not sure if this thread is still active but I also struggled with this same exercise. I offer the following solution as a thing to shoot at: myInit :: [a] -> [a] myInit ys = foldr snoc [] $ (\(x:xs) -> xs) $ foldr snoc [] ys where snoc = (\x xs -> xs ++ [x]) Note that snoc is defined at the top of the same page as the exercise in Simon's book. ::paul