[Haskell-beginners] reorganizing lists

divyanshu ranjan idivyanshu.ranjan at gmail.com
Mon Jan 28 19:44:18 CET 2013


Hi,
  You can use foldl (\(fx, fy) [x,y] -> (x:fx, y:fy)) ([],[])

Thanks
Divyanshu Ranjan

On Tue, Jan 29, 2013 at 12:07 AM, Bryce Verdier <bryceverdier at gmail.com>wrote:

> Hi All,
>
> At the moment I have a list of lists. The inner list is a coordinate, like
> (x,y) but is [x,y] instead. What I would like to do is group all the x's
> into one list, and the y's into another. I know I can do this with calling
> 2 maps on the container, but I would also like to do this in one iteration.
>
> Does anyone have any ideas?
>
> Thanks in advance,
> Bryce
>
>
>
> ______________________________**_________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/**mailman/listinfo/beginners<http://www.haskell.org/mailman/listinfo/beginners>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130129/61593332/attachment.htm>


More information about the Beginners mailing list