[Haskell-beginners] Eq a => [a]->[a]

I. J. Kennedy jack at realmode.com
Wed Dec 2 19:47:54 EST 2009

I am looking for a function
 f::Eq a => [a]->[a]
that takes a list and returns the longest
initial segment of the list for which all
the elements are distinct.

For example f [2,3,6,4,3,5] = [2,3,6,4].

I didn't see anything that matched using Hoogle,
but I thought this might be a common enough
operation that this function might exists somewhere
in the standard packages.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20091202/901cb706/attachment.html

More information about the Beginners mailing list