[Haskell-cafe] Re: Implementing "unionAll"

Ozgur Akgun ozgurakgun at gmail.com
Wed Feb 17 12:59:42 EST 2010


Ooops I thought the inner lists are possibly of infinite size.

On 17 February 2010 17:16, Daniel Fischer <daniel.is.fischer at web.de> wrote:

> Am Mittwoch 17 Februar 2010 17:46:38 schrieb Ozgur Akgun:
> > > The easiest solution is simply to define
> > >
> > >    unionAll = nub . mergeAll
> > >        where
> > >        -- specialized definition of  nub
> > >        nub = map head . groupBy (==)
> >
> > Talking about the easiest solution, I guess this is a quite easy way of
> > defining unionAll as well: http://gist.github.com/306782
> > I, of course, do not claim that it is more efficient or better. But I
> > don't think it'd be rubbish :)
>
> let
>                next = minimum (map head xs')
>
> doesn't work if you have infinitely many lists :(
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100217/c1b68b64/attachment.html


More information about the Haskell-Cafe mailing list