5 Dec
2010
5 Dec
'10
6:20 a.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