<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-04-12 18:35 GMT+02:00 Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
&gt; On 12.04.2016, at 11:10, Tobias Pape &lt;<a href="mailto:Das.Linux@gmx.de">Das.Linux@gmx.de</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On 12.04.2016, at 08:38, marcel.taeumel &lt;<a href="mailto:Marcel.Taeumel@hpi.de">Marcel.Taeumel@hpi.de</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Hi Tobias,<br>
&gt;&gt;<br>
&gt;&gt; this version is made for endless streams, not the ones the always operate on<br>
&gt;&gt; a collection but sockets etc. So, the generator never ends and hence #atEnd<br>
&gt;&gt; is never true. I thought that #upToNil might be sufficient and also<br>
&gt;&gt; practical for other streams.<br>
&gt;&gt;<br>
&gt;&gt; Best,<br>
&gt;&gt; Marcel<br>
&gt;<br>
&gt;<br>
&gt; Sounds reasonable :)<br>
<br>
</span>Actually, no, it does not ;)<br>
<br>
If the stream hasn’t ended, the generator should continue. If the stream is at end, the generator should stop.<br>
<br>
We don’t need #upToNil, you just need to stop the generator when the stream ends:<br>
<br>
select: block<br>
        ^ Generator on: [:g |<br>
                [self atEnd] whileFalse: [<br>
                        | object |<br>
                        object := self next.<br>
                        (block value: object) ifTrue: [g yield: object]]]<br>
<br>
... and similarly for the other methods. With that change, #upToEnd works just fine on the generator.<br>
<br>
Agreed? :)<br>
<span class="HOEnZb"><font color="#888888"><br>
- Bert -<br>
<br>
<br></font></span></blockquote><div>+1,<br>what&#39;s so special about nil?<br>For me upToNil is just upTo: nil <br></div></div><br></div><div class="gmail_extra">Nicolas<br></div></div>