<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Nico,</p>
    <p>I'm convinced this only works without the extra [] value because
      you chose a special selector. For keyword-selector it should go to
      "self".</p>
    <p>Which part exactly is not optimized? The "ifTrue:" has a special
      handling in the bytecode complier, and iirc yourself is also not
      "actually sent".</p>
    <p>Cdlt</p>
    <p>Torge<br>
    </p>
    <div class="moz-cite-prefix">On 16.05.19 17:08, Nicolas Cellier
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKnRiT7dr4RSPB7SDZW8CdvYnY+zQ47Zk8_Ede3EM610ekJbPQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi,</div>
        <div>Ah yes, it works, no need for extra [] value<br>
        </div>
        <div><br>
        </div>
        <div>    (3 > 2) ifTrue: [Transcript cr; show: 'bingo!'];
          yourself</div>
        <div><br>
        </div>
        <div>The code is not optimized, but it works.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Le jeu. 16 mai 2019 à 16:52,
          Torge Husfeldt <<a href="mailto:torge.husfeldt@gmx.de"
            moz-do-not-send="true">torge.husfeldt@gmx.de</a>> a
          écrit :<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>Salut Nico,</p>
            <p>please excuse if my squeak knowlege is a bit rusty, but
              wouldn't this do the job:</p>
            <p>self findlast: [:each |<br>
            </p>
            <p>[self testSomeConditionFor: each] value ifTrue:[self
              performSomeAction:each]; yourself.</p>
            <p>].</p>
            <p>Just an idea. And very sad that I have to wrap the
              condition in a block, but I guess othewise the recipient
              for "yourself" would be "self"<br>
            </p>
            <div class="gmail-m_-6434532090840975697moz-cite-prefix">On
              14.05.19 17:02, Nicolas Cellier wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Oups, my example was a bit stupid because findLast:
                  loop stops at first true, but you get my intention...</div>
                <div>Replace with select:/reject: or provide a
                  whenFalse: side effect...<br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">Le mar. 14 mai 2019
                  à 16:23, Nicolas Cellier <<a
                    href="mailto:nicolas.cellier.aka.nice@gmail.com"
                    target="_blank" moz-do-not-send="true">nicolas.cellier.aka.nice@gmail.com</a>>
                  a écrit :<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">
                    <div>Hi,</div>
                    <div>From time to time, I need to perform some
                      additional action (side effect) when a boolean is
                      true, but preserve that boolean as return value.</div>
                    <div><br>
                    </div>
                    <div>Here is a pseudo example:<br>
                    </div>
                    <div><br>
                    </div>
                    <div>    self findLast: [:each |</div>
                    <div>        | conforming |<br>
                    </div>
                    <div>        conforming := self
                      testSomeConditionFor: each.</div>
                    <div>        conforming <br>
                    </div>
                    <div>            ifTrue:</div>
                    <div>                [ "found one, do some side
                      effect before searching next" <br>
                    </div>
                    <div>                self performSomeAction: each ].<br>
                    </div>
                    <div>         conforming ].</div>
                    <div><br>
                    </div>
                    <div>Or shorter, but I dislike the redundant true:
                      <div><br>
                      </div>
                      <div>    self findLast: [:each |</div>
                      <div>        (self testSomeConditionFor: each)</div>
                      <div>            and:</div>
                      <div>                [ "found one, do some side
                        effect before searching next" <br>
                      </div>
                      <div>                self performSomeAction: each.</div>
                      <div>                true ]].</div>
                      <div><br>
                      </div>
                      <div>What i seek is even shorter:
                        <div><br>
                        </div>
                        <div>    self findLast: [:each |</div>
                        <div>        (self testSomeConditionFor: each)</div>
                        <div>            whenTrue:</div>
                        <div>                [ "found one, do some side
                          effect before searching next" <br>
                        </div>
                        <div>                self performSomeAction:
                          each ]].</div>
                        <div><br>
                        </div>
                        <div>Of course, we would have companions
                          whenFalse:, whenTrue:whenFalse:...<br>
                        </div>
                        <div>Would you buy it?<br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
              </div>
              <br>
              <fieldset
                class="gmail-m_-6434532090840975697mimeAttachmentHeader"></fieldset>
            </blockquote>
          </div>
          <br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
  </body>
</html>