[Haskell-beginners] Translating a while

Yitzchak Gale gale at sefer.org
Mon Mar 8 09:40:18 EST 2010


> j xs = maybeLast . filter snd . zip [0..] $ zipWith (<) xs (drop 1 xs)
>  where
>    maybeLast [] = Nothing
>    maybeLast xs = Just (last xs)

Make that j xs = fmap fst . maybeLast . ... etc.

-Yitz


More information about the Beginners mailing list