Email list hosting service & mailing list manager


Typo in wrong implementation for stream-filter Alejandro Forero Cuervo 22 Dec 2003 17:27 UTC
The  sample  (wrong)  implementation for  stream-filter  has  the
parenthesis wrong and will not even run:

    (stream-define (stream-filter pred? strm)
      (cond ((stream-null? strm) strm)
            ((pred? (stream-car strm)
              (stream-cons (stream-car strm)
                           (stream-filter pred? (stream-cdr strm)))
            (else (stream-filter pred? (stream-cdr strm)))))

I think you really mean:

    (stream-define (stream-filter pred? strm)
      (cond ((stream-null? strm) strm)
            ((pred? (stream-car strm))
              (stream-cons (stream-car strm)
                           (stream-filter pred? (stream-cdr strm))))
            (else (stream-filter pred? (stream-cdr strm)))))

Thanks.

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?