[Haskell-cafe] how to calculate the sum of list of lists?

Eric Olander olandere at gmail.com
Mon Feb 5 12:00:33 EST 2007


If I understand you correctly, this should do it:

sums :: Num a => [[a]] -> a
sums l = sum [sum p | p <- l]

-Eric

On 2/5/07, Miranda Kajtazi <mirandakajtazi at gmail.com> wrote:
>
> Help,
>
> How to calculate the sum of list of lists in Haskell?
> Please help me,
> Miranda
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070205/e144522f/attachment.htm


More information about the Haskell-Cafe mailing list