<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 14, 2018 at 8:10 PM Vanessa McHale <<a href="mailto:vanessa.mchale@iohk.io">vanessa.mchale@iohk.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>Yes, that was what I was never quite clear on. What is your
      *actual problem, in context*, not the problem you think you have
      because you read elsewhere that foldl' is more efficient?<br>
    </p>
    <br></div></blockquote><div>The problem I have is that sum consumes huge amount of memory. In particular I'm modeling the Chimeric ledgers described in this paper <a href="https://eprint.iacr.org/2018/262.pdf">https://eprint.iacr.org/2018/262.pdf</a>. In several places I have to sum up values in different lists, and as soon as I try this with large lists the memory usage blows up. So that's my concrete scenario.</div><div><br></div><div>In view of this, I though, "I can write this replacing `sum` by `foldl' (+) 0` but wouldn't be nice if this function was defined already somewhere else?" That's it.</div><div><br></div><div>Please ignore this if it is a silly question, and my apologies in advance.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <div class="gmail-m_4600259978239127383moz-cite-prefix">On 08/14/2018 01:07 PM, Bryan Richter
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>On 08/14/2018 11:22 AM, Damian Nadales wrote:

</pre>
      <blockquote type="cite">
        <pre>Ok, so if understood the bottom line of the answers I got from
Vanessa and Hiromi the take away seems to be: if you're prototyping
then stick to the lazy version of sum, otherwise use more advanced
data structures (Vectors or Folds).
</pre>
      </blockquote>
      <pre>Are you implying that lazy functions are only good for prototyping? Or
is there something wrong with sum in particular?

More generally, why isn't sum working for you?

</pre>
      <br>
      <fieldset class="gmail-m_4600259978239127383mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="gmail-m_4600259978239127383moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
    </blockquote>
  </div>

_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div>