<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Francisco,<br>
    <br>
    Just pushed a slight variation of your code. Thanks!<br>
    <br>
    Cheers,<br>
    On 11/5/2022 8:56 AM, Francisco Garau via Cuis-dev wrote:
    <blockquote
cite="mid:CAKAN0Ge6576oZS+4kOPu6BYdkf56Vb9uK=eDNXa9fKSKpO8JwA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>I've checked in a CuisUniversity-5096 image and here is the
          optimization: </div>
        <div><br>
        </div>
        <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
          none; padding: 0px;"><b>RunArray>>sum </b>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> "</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"><i> (RunArray new: 4096 withAll: 3) sum
              =  12288.</i></blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"><i> ([(RunArray new) sum] on: Error do:
              [:ex | ex messageText] ) = 'this collection is empty'.</i></blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> "</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> | initial sum |</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> self isEmpty ifTrue: [self
            errorEmptyCollection].</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> initial := self first.</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> sum := initial.</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> self runsAndValuesDo: [:run :value |
            sum := sum + (run * value)].</blockquote>
          <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
            none; padding: 0px;"> ^ sum - initial</blockquote>
        </blockquote>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sat, 5 Nov 2022 at 10:26,
          Francisco Garau <<a moz-do-not-send="true"
            href="mailto:francisco.garau@gmail.com">francisco.garau@gmail.com</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 dir="auto">Do we have RunArray in Cuis? We could have a
            similar optimisation in there<br>
            <div><br>
              <div dir="ltr">- Francisco</div>
              <div dir="ltr"><br>
                <blockquote type="cite">On 2 Nov 2022, at 18:25, Juan
                  Vuletich via Cuis-dev <<a moz-do-not-send="true"
                    href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>
                  wrote:<br>
                  <br>
                </blockquote>
              </div>
              <blockquote type="cite">
                <div dir="ltr"> On 11/1/2022 11:23 PM, Hernán Wilkinson
                  via Cuis-dev wrote:
                  <blockquote type="cite">
                    <div dir="ltr">yeap, the current implementation is
                      not correct.
                      <div>Juan, attached is a change set that fixes it
                        and another with the related tests.</div>
                      <div><br>
                      </div>
                      <div>Cheers!</div>
                      <div>Hernan.</div>
                    </div>
                    <br>
                    <div class="gmail_quote">
                      <div dir="ltr" class="gmail_attr">On Tue, Nov 1,
                        2022 at 3:39 AM Luciano Notarfrancesco <<a
                          moz-do-not-send="true"
                          href="mailto:luchiano@gmail.com"
                          target="_blank">luchiano@gmail.com</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 dir="auto">I’m afk right now so I cannot
                          check, but it sounds like I made a mistake. Of
                          course it should be the value of aBlock at
                          each element times the number of occurrences.</div>
                        <div><br>
                          <div class="gmail_quote">
                            <div dir="ltr" class="gmail_attr">On Tue, 1
                              Nov 2022 at 07:33 Hernán Wilkinson <<a
                                moz-do-not-send="true"
                                href="mailto:hernan.wilkinson@10pines.com"
                                target="_blank">hernan.wilkinson@10pines.com</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 dir="ltr">Hi,
                                <div> the implementation of
                                  Bag>>#sum: aBlock ifEmpty:
                                  emptyBlock does not use the parameter
                                  aBlock at all and assumes that each of
                                  the elements answers the message * </div>
                                <div> <a moz-do-not-send="true"
                                    class="gmail_plusreply"
id="m_6443050436973331513m_-3423588523307269653m_4335152602574426633plusReplyChip-0"
                                    href="mailto:luchiano@gmail.com"
                                    target="_blank">@Luciano
                                    Notarfrancesco</a> the
                                  implementation is yours and it is very
                                  new? Is there a reason you did that
                                  way? </div>
                                <div><br>
                                </div>
                                <div>Thanks</div>
                                <div>Hernan</div>
                              </div>
                              <div dir="ltr">
                                <div><br clear="all">
                                  <div><br>
                                  </div>
                                  -- <br>
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div>
                                        <div dir="ltr">
                                          <div style="font-size: small;">
                                            <div dir="ltr">
                                              <div dir="ltr">
                                                <div style="font-size:
                                                  12.8px;"><span
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    font-size: xx-small;
                                                    border-collapse:
                                                    collapse;"><strong
                                                      style="font-family:
tahoma,sans-serif;"><span style="font-size: 8pt; font-family:
                                                        tahoma,sans-serif;"><span
                                                          style="font-size:
                                                          small;
                                                          font-family:
                                                          tahoma,sans-serif;"><font
                                                          style="font-family:
                                                          tahoma,sans-serif;
                                                          color: rgb(0,
                                                          0, 0);"
                                                          size="2"><span
                                                          style="font-weight:
                                                          normal;
                                                          font-family:
                                                          tahoma,sans-serif;"><span
                                                          style="font-weight:
                                                          bold;
                                                          font-family:
                                                          tahoma,sans-serif;">Hernán

                                                          Wilkinson</span><br>
                                                          Agile Software
                                                          Development,
                                                          Teaching &
                                                          Coaching</span></font></span></span></strong></span></div>
                                                <div style="font-size:
                                                  12.8px;"><span
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    font-size: xx-small;
                                                    border-collapse:
                                                    collapse;"><strong
                                                      style="font-family:
tahoma,sans-serif;"><span style="font-size: 8pt; font-family:
                                                        tahoma,sans-serif;"><span
                                                          style="font-size:
                                                          small;
                                                          font-family:
                                                          tahoma,sans-serif;"><font
                                                          style="font-family:
                                                          tahoma,sans-serif;
                                                          color: rgb(0,
                                                          0, 0);"
                                                          size="2"><span
                                                          style="font-weight:
                                                          normal;
                                                          font-family:
                                                          tahoma,sans-serif;">Phone:

                                                          +54-011</span></font></span></span></strong></span><font
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    color: rgb(0, 0,
                                                    0);" size="2"
                                                    face="tahoma,
                                                    sans-serif">-4893-2057</font></div>
                                                <div style="font-size:
                                                  12.8px;"><strong
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    font-size:
                                                    xx-small;"><span
                                                      style="font-size:
                                                      8pt; font-family:
tahoma,sans-serif;"><span style="font-size: small; font-family:
                                                        tahoma,sans-serif;"><font
                                                          style="font-family:
                                                          tahoma,sans-serif;
                                                          color: rgb(0,
                                                          0, 0);"
                                                          size="2"><span
                                                          style="font-weight:
                                                          normal;
                                                          font-family:
                                                          tahoma,sans-serif;">Twitter:

@HernanWilkinson</span></font></span></span></strong></div>
                                                <div style="font-size:
                                                  12.8px;"><span
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    font-size: xx-small;
                                                    border-collapse:
                                                    collapse;"><strong
                                                      style="font-family:
tahoma,sans-serif;"><span style="font-size: 8pt; font-family:
                                                        tahoma,sans-serif;"><span
                                                          style="font-size:
                                                          small;
                                                          font-family:
                                                          tahoma,sans-serif;"><font
                                                          style="font-family:
                                                          tahoma,sans-serif;
                                                          color: rgb(0,
                                                          0, 0);"
                                                          size="2"><span
                                                          style="font-weight:
                                                          normal;
                                                          font-family:
                                                          tahoma,sans-serif;">site: <a
moz-do-not-send="true" href="http://www.10pines.com/"
                                                          style="font-family:
                                                          tahoma,sans-serif;
                                                          color: rgb(17,
                                                          65, 112);"
                                                          target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div>
                                                <div style="font-size:
                                                  12.8px;"><font
                                                    style="font-family:
                                                    tahoma,sans-serif;
                                                    color: rgb(0, 0,
                                                    0);" face="tahoma,
                                                    sans-serif"><span
                                                      style="border-collapse:
                                                      collapse;
                                                      font-family:
                                                      tahoma,sans-serif;">Address:

                                                      Alem 896</span></font>,
                                                  Floor 6, Buenos Aires,
                                                  Argentina</div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </blockquote>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br clear="all">
                    <div><br>
                    </div>
                    -- <br>
                    <div dir="ltr">
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div style="font-size: small;">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div style="font-size: 12.8px;"><span
                                      style="font-family:
                                      tahoma,sans-serif; font-size:
                                      xx-small; border-collapse:
                                      collapse;"><strong><span
                                          style="font-size: 8pt;"><span
                                            style="font-size: small;"><font
                                              size="2"><span
                                                style="font-weight:
                                                normal;"><span
                                                  style="font-weight:
                                                  bold;">Hernán
                                                  Wilkinson</span><br>
                                                Agile Software
                                                Development, Teaching
                                                & Coaching</span></font></span></span></strong></span></div>
                                  <div style="font-size: 12.8px;"><span
                                      style="font-family:
                                      tahoma,sans-serif; font-size:
                                      xx-small; border-collapse:
                                      collapse;"><strong><span
                                          style="font-size: 8pt;"><span
                                            style="font-size: small;"><font
                                              size="2"><span
                                                style="font-weight:
                                                normal;">Phone: +54-011</span></font></span></span></strong></span><font
                                      size="2" face="tahoma, sans-serif">-4893-2057</font></div>
                                  <div style="font-size: 12.8px;"><strong
                                      style="font-family:
                                      tahoma,sans-serif; font-size:
                                      xx-small;"><span style="font-size:
                                        8pt;"><span style="font-size:
                                          small;"><font size="2"><span
                                              style="font-weight:
                                              normal;">Twitter:
                                              @HernanWilkinson</span></font></span></span></strong></div>
                                  <div style="font-size: 12.8px;"><span
                                      style="font-family:
                                      tahoma,sans-serif; font-size:
                                      xx-small; border-collapse:
                                      collapse;"><strong><span
                                          style="font-size: 8pt;"><span
                                            style="font-size: small;"><font
                                              size="2"><span
                                                style="font-weight:
                                                normal;">site: <a
                                                  moz-do-not-send="true"
href="http://www.10pines.com/" style="color: rgb(17, 65, 112);"
                                                  target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div>
                                  <div style="font-size: 12.8px;"><font
                                      face="tahoma, sans-serif"><span
                                        style="border-collapse:
                                        collapse;">Address: Alem 896</span></font>,
                                    Floor 6, Buenos Aires, Argentina</div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                  <br>
                  Hi Hernán,<br>
                  <br>
                  Your fix disables the optimization Luciano did. I
                  chose to fix Luciano's code. Did the same for
                  #product: (same bug). Integrated your tests, and added
                  another one for #product:<br>
                  <br>
                  Thanks,<br>
                  <pre cols="72">-- 
Juan Vuletich
<a moz-do-not-send="true" href="http://cuis.st" target="_blank">cuis.st</a>
<a moz-do-not-send="true" href="http://github.com/jvuletich" target="_blank">github.com/jvuletich</a>
<a moz-do-not-send="true" href="http://researchgate.net/profile/Juan-Vuletich" target="_blank">researchgate.net/profile/Juan-Vuletich</a>
<a moz-do-not-send="true" href="http://independent.academia.edu/JuanVuletich" target="_blank">independent.academia.edu/JuanVuletich</a>
<a moz-do-not-send="true" href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">patents.justia.com/inventor/juan-manuel-vuletich</a>
<a moz-do-not-send="true" href="http://linkedin.com/in/juan-vuletich-75611b3" target="_blank">linkedin.com/in/juan-vuletich-75611b3</a>
<a moz-do-not-send="true" href="http://twitter.com/JuanVuletich" target="_blank">twitter.com/JuanVuletich</a></pre>
                  <span>-- </span><br>
                  <span>Cuis-dev mailing list</span><br>
                  <span><a moz-do-not-send="true"
                      href="mailto:Cuis-dev@lists.cuis.st"
                      target="_blank">Cuis-dev@lists.cuis.st</a></span><br>
                  <span><a moz-do-not-send="true"
                      href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
                      target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a></span><br>
                </div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
  </body>
</html>