minor reorganizations
svn: r16743
This commit is contained in:
parent
2153c258db
commit
82f10f35a5
|
@ -44,9 +44,6 @@
|
||||||
(for-each (lambda (x) (fprintf port fmt x)) p))
|
(for-each (lambda (x) (fprintf port fmt x)) p))
|
||||||
(display ")>" port)])))
|
(display ")>" port)])))
|
||||||
|
|
||||||
(define-struct promise (val)
|
|
||||||
#:mutable
|
|
||||||
#:property prop:custom-write promise-printer)
|
|
||||||
;; A promise value can hold
|
;; A promise value can hold
|
||||||
;; - (list <value> ...): forced promise (possibly multiple-values, usually one)
|
;; - (list <value> ...): forced promise (possibly multiple-values, usually one)
|
||||||
;; - <promise>: a shared (redirected) promise that points at another one
|
;; - <promise>: a shared (redirected) promise that points at another one
|
||||||
|
@ -54,6 +51,8 @@
|
||||||
;; - can also hold a `running' thunk that will throw a reentrant error
|
;; - can also hold a `running' thunk that will throw a reentrant error
|
||||||
;; - can also hold a raising-a-value thunk on exceptions and other
|
;; - can also hold a raising-a-value thunk on exceptions and other
|
||||||
;; `raise'd values (actually, applicable structs for printouts)
|
;; `raise'd values (actually, applicable structs for printouts)
|
||||||
|
(define-struct promise ([val #:mutable])
|
||||||
|
#:property prop:custom-write promise-printer)
|
||||||
|
|
||||||
;; Creates a `composable' promise
|
;; Creates a `composable' promise
|
||||||
;; X = (force (lazy X)) = (force (lazy (lazy X))) = (force (lazy^n X))
|
;; X = (force (lazy X)) = (force (lazy (lazy X))) = (force (lazy^n X))
|
||||||
|
@ -121,8 +120,8 @@
|
||||||
(cond [(procedure? p)
|
(cond [(procedure? p)
|
||||||
;; mark the root as running: avoids cycles, and no need to keep
|
;; mark the root as running: avoids cycles, and no need to keep
|
||||||
;; banging the root promise value; it makes this non-r5rs, but
|
;; banging the root promise value; it makes this non-r5rs, but
|
||||||
;; only practical uses of these things could be ones that use
|
;; the only practical uses of these things could be ones that use
|
||||||
;; state.
|
;; state to avoid an infinite loop.
|
||||||
;; (careful: avoid holding a reference to the thunk, to allow
|
;; (careful: avoid holding a reference to the thunk, to allow
|
||||||
;; safe-for-space loops)
|
;; safe-for-space loops)
|
||||||
(set-promise-val! promise (make-running (object-name p)))
|
(set-promise-val! promise (make-running (object-name p)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user