[Haskell-beginners] Creating a Triple List from a List

David McBride toad3k at gmail.com
Tue Mar 2 14:19:14 UTC 2021


If you are okay with a library, you can use the split library for this.

stack exec --package split -- ghci
>chunksOf 2 [1,2,3,4,5,6]
[[1,2],[3,4],[5,6]]

On Sat, Feb 27, 2021 at 9:08 PM A. Mc. <47dragonfyre at gmail.com> wrote:

> Hello,
>
> What is the best way to take:
> [1, 2, 3, 4 ]
>
> And convert it to:
>
> [ [ [ 1 ], [ 2 ] ], [ [3]. [4] ] ]
>
> so that each member pair is:
>
> [ [1], [2] ]
>
> roughly analogous to a 1x2 vector?
>
> Thanks in advance and thank you for your time.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210302/fa189b05/attachment.html>


More information about the Beginners mailing list