<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks. That clears it up somewhat. I sent a copy of my message to the SRFI 41 mail site. Is there anything else I should do, such as forward your comments to them?<br><br>Michael<br><br>--- On <b>Wed, 10/8/08, Jens Axel Soegaard <i>&lt;jensaxel@soegaard.net&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Jens Axel Soegaard &lt;jensaxel@soegaard.net&gt;<br>Subject: Re: [plt-scheme] SRFI 41<br>To: nowgate@yahoo.com<br>Cc: plt-scheme@list.cs.brown.edu<br>Date: Wednesday, October 8, 2008, 2:42 PM<br><br><pre>michael rice skrev:<br>&gt; There's a stream-member function given in SRFI 41 that doesn't<br>seem to <br>&gt; work as expected.<br>&gt;<br>&gt; =================<br>&gt;<br>&gt; (require srfi/41)<br>&gt;<br>&gt; (define s1 (stream-cons 'a (stream-cons 'b
 stream-null)))<br>&gt;<br>&gt; (define-stream (stream-member eql? obj strm)<br>&gt;   (stream-let loop ((strm strm))<br>&gt;     (cond ((stream-null? strm) #f)<br>&gt;           ((eql? obj (stream-car strm)) strm)<br>&gt;           (else (loop (stream-cdr strm))))))<br>&gt;<br>&gt; ===================<br>&gt;<br>&gt; Welcome to DrScheme, version 4.1 [3m].<br>&gt; Language: Swindle; memory limit: 128 megabytes.<br>&gt; &gt; (stream-member equal? 'c s1)<br>&gt; #&lt;stream&gt;<br>&gt; &gt;<br>&gt;<br>&gt; ===================<br>&gt;<br>&gt; Shouldn't the answer be #f?<br>&gt;<br>&gt; Michael<br>&gt;<br>&gt;<br><br>The documentation for srfi 41 says:<br><br>(stream-let tag ((var expr) ...) body)<br><br>... stream-let evaluates the expressions in its body in an environment <br>containing<br>the newly-bound variables, returning the value of the last expression <br>evaluated,<br>which must yield a stream.<br><br>Since #f is not a stream, the behaviour is
 undefined.<br><br>Note that evaluating (stream-car (stream-member equal? 'c s1)) gives #f.<br><br>But... The example rises a few questions:<br><br>  Is PLT using the reference implementation of srfi 41?<br><br>  If not, it would be a worth chaning the behaviour of stream-let to<br>  match the reference implementation.<br><br>  Was it intentional that this behaviour is undefined?<br><br>   If it is unintentional, maybe an error message would be better<br>   than matching the behaviour of the reference implementation?<br> <br><br><br>-- <br>Jens Axel Søgaard<br><br></pre></blockquote></td></tr></table><br>