racket/collects/srfi/45/lazy.rkt
Eli Barzilay 12211fff72 Various lazy-related fixes etc.
* A long-standing bug, which happened with
    (let ([x (lazy (delay 1))]) (force x) (force x))
  not being properly handled.

* Added `delay/strict', mostly for the below.

* Made srfi/45 reprovide it as `eager'.

* Also restricted the exports from srfi/45 to its interface.

All of these issues were reported by Andreas Rottmann.
2010-05-21 15:12:16 -04:00

17 lines
798 B
Racket

#lang scheme/base
;; scheme/promise has srfi-45-style primitives
(require scheme/promise)
(provide delay lazy force
;; Strictly speaking, this should be a procedure according to srfi-45.
;; It's easy to make it one, but then it loses its ability to deal
;; with multiple values (which the srfi completely ignores).
(rename-out [delay/strict eager]))
;; TODO: there is a small difference between the primitives in srfi-45 and the
;; ones provided by scheme/promise (the latter is a bit more permissive). See
;; "library approach" in scheme/promise and see the post-finalization
;; discussion on the srfi-45 list. I (Eli) showed at some point how the
;; "language approach" primitives can be used to implement the other, and this
;; needs to be done here too.