[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with SRFI document



David Van Horn <dvanhorn-uTS83RNB0zM3uPMLIKxrzw@xxxxxxxxxxxxxxxx> writes:

>
> I've checked in changes to address both of these issues.  Please
> let me know if any other problems exist with the reference
> implementation.
>
> David
>

Hello David,

actually there is another problem with the reference
implementation. With the code from
http://srfi.schemers.org/srfi-40/srfi-40.html downloaded on January
5th, 2005 I get the following error:

> mzscheme -L 9.ss srfi --load srfi-40-ref.scm
Welcome to MzScheme version 208, Copyright (c) 2004 PLT Scheme, Inc.
> (stream-car (stream 1 2 3))
car: expects argument of type <pair>; given lazy

The problem is in the definition of stream-low-level-force which for
the chosen implementation of a promise I believe should read:

(define (stream-low-level-force promise)
    (case (car promise)
      ((eager) (cdr promise))
      ((lazy)  (let ((promise* (stream-promise ((cdr promise)))))
                 (if (not (eqv? (car promise*) 'eager))
                     (begin (set-car! promise (car promise*))
                            (set-cdr! promise (cdr promise*))
                            (set-car! promise* promise)))
                 (stream-low-level-force promise)))))

Cheers,

        Alex