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

Re: [Scheme-reports] Formal Comment: what is the required behavior of 'lazy'?

On Wed, Jun 27, 2012 at 11:58 AM, Richard Kelsey <kelsey@x> wrote:
> Formal Comment
> Submitter's name: Richard Kelsey
> Submitter's email: kelsey at s48.org
> Relevant draft: r7rs draft 6
> Type: clarification
> Priority: minor
> Relevant section of draft: Derived expression types
> Summary: 'lazy' is underspecified
> The description of (lazy <expression>) says
>  The returned promise, when forced, will evaluate to whatever the
>  original promise would have evaluated to if it had been forced.
> This describes what
>  (delay (force <expression>))
> does.  On the other hand, the description of the stream-filter example
> says that '(lazy <x>)' is not the same as '(delay (force <x>))'.  If
> this is true, the description of 'lazy' needs to say what the
> difference is.

Thanks!  This had already been fixed in the repository and
currently reads:

  The expression (delay-force expression) is conceptually similar to
  (delay (force expression)), with the difference that forcing the
  result of delay-force will in effect result in a tail call to (force
  expression), while forcing the result of (delay (force expression))
  may not.  Thus iterative lazy algorithms that may result in a long
  series of chains of delay and force can be rewritten using
  delay-force to prevent consuming unbounded space during evaluation.

(where lazy has been renamed delay-force).


Scheme-reports mailing list