<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><jensaxel@soegaard.net></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Jens Axel Soegaard <jensaxel@soegaard.net><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>> There's a stream-member function given in SRFI 41 that doesn't<br>seem to <br>> work as expected.<br>><br>> =================<br>><br>> (require srfi/41)<br>><br>> (define s1 (stream-cons 'a (stream-cons 'b
stream-null)))<br>><br>> (define-stream (stream-member eql? obj strm)<br>> (stream-let loop ((strm strm))<br>> (cond ((stream-null? strm) #f)<br>> ((eql? obj (stream-car strm)) strm)<br>> (else (loop (stream-cdr strm))))))<br>><br>> ===================<br>><br>> Welcome to DrScheme, version 4.1 [3m].<br>> Language: Swindle; memory limit: 128 megabytes.<br>> > (stream-member equal? 'c s1)<br>> #<stream><br>> ><br>><br>> ===================<br>><br>> Shouldn't the answer be #f?<br>><br>> Michael<br>><br>><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>