Something like the belo 'foldL_last'? You could probably do it cleaner, but I don't think there is a library function that would help any more than foldl.
foldL_last :: (a -> b -> a) -> a -> [b] -> (Maybe b, a) foldL_last f x xs = foldl (\(_,a) b -> (Just b, f a b)) (Nothing, x) xs Tom On Thu, Jun 11, 2009 at 6:47 PM, Casey Hawthorne<cas...@istar.ca> wrote: > When folding is there a way to pick out the last point being > processed? > > The first point can easily be picked out with (x:xs) but last xs > crawls down the list. > -- > Regards, > Casey > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe