<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 2 janv. 2020 à 22:09, Jakob Reschke <<a href="mailto:forums.jakob@resfarm.de">forums.jakob@resfarm.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 dir="ltr"><div dir="ltr">Am Do., 2. Jan. 2020 um 21:12 Uhr schrieb Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>:</div><div class="gmail_quote"><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 class="gmail_quote"><div>If we strictly adhere to this interpretation of method comment, detectMin: detectMax: detect:ifNone: and count: should also iterate on each and every element.</div><div>Do you agree that count: hardly benefits from such definition?</div></div></div></blockquote><div><br></div><div>Instinctively I wanted to reply that the optimization in RunArray does not change the result of these operations contrary to collect: because they do not change elements, so equal elements could not suddenly become non-equal elements during the operation. But it got me thinking that I cannot imagine these usefully with side effects in the blocks... :-)</div><div><br></div><div>What about do: and inject:into: instead? Would you evaluate their blocks only once per run?</div></div></div>
<br></blockquote><div>No.</div><div>It would mean changing the semantics.</div><div>I don't want to change the semantics, just the implementation.</div><div>We have other selectors available for RunArray specific semantic, like aRunArray values do:, aRunArray runsAndValuesDo:</div><div><br></div><div>Side effects in collect: and select: (and count: etc...) are border line.</div><div>Either we expect that those methods must enumerate exactly like do: in order to support side effects uniformely.</div><div>Your reaction perfectly  demonstrates that this can be a legitimate expectation.<br></div><div>Or we consider that the enumeration is implementation defined, as long as the methods maps, filter, (count etc...).</div><div>I think that RunArray has a greater value in itself if we adopt the later, but it's only my own opinion so far.<br></div><div><br></div></div></div>