
Sebastian Sylvan-2 wrote:
I'm not sure I completely understand what you want, and if it needs to be "cute" (i.e. some clever one liner usage of a library function). But here's my "get-the-job-done-solution" (assuming I understood what you want):
import Data.List import Data.Ord
longestInSequence :: (Enum a) => [a] -> Int longestInSequence = maximum . map (length . takeInSeq) . tails
takeInSeq [] = [] takeInSeq [x] = [x] takeInSeq (x:y:xs) | fromEnum (succ x) == fromEnum y = x : takeInSeq (y:xs) | otherwise = takeInSeq (x:xs)
/S
Thanks, that's what I was looking for - and it doesn't need to be 'cute'! -- View this message in context: http://www.nabble.com/mapAccumL---find-max-in-sequence-subsequence-tf2531704... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.