Changeset 14170 in project


Ignore:
Timestamp:
04/08/09 05:51:53 (11 years ago)
Author:
Kon Lovett
Message:

Release.

Location:
release/4/srfi-45
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-45/tags/2.1.0/srfi-45.scm

    r14160 r14170  
    5555  ; SRFI 45
    5656  (lazy $$finlzy)
    57   eager
     57  (eager $$finegr)
    5858  d-lay ; since we don't redefine R5RS `delay'
    5959  promise?
     
    7575
    7676(define ($$finlzy thunk) (%make-lazy-promise thunk))
     77(define ($$finegr ls) (%make-eager-promise ls))
    7778
    7879(define-syntax lazy (syntax-rules () ((_ ?expr) ($$finlzy (lambda () ?expr)))))
    79 (define (eager value) (%make-eager-promise (list value)))
    80 (define-syntax d-lay (syntax-rules () ((_ ?exp) (lazy (eager ?exp)))))
     80(define-syntax eager (syntax-rules () ((_ ?expr) ($$finegr (receive ?expr)))))
     81(define-syntax d-lay (syntax-rules () ((_ ?expr) (lazy (eager ?expr)))))
    8182
    8283;; Predicates
     
    107108            (if (%procedure? value)
    108109                ; Force the promise by invoking the thunk
    109                 (let* ((value* (receive (value)))
     110                (let* ((value (receive (value)))
    110111                       ; Re-fetch and check the top promise again in case it recursed into `force'
    111112                       (prmbox (and (%recursive-promise? prm) (%promise-box prm))) )
    112                   ; Copy the promise to the top
     113                  ;
    113114                  (cond
     115                    ; R5RS promise or Eager
    114116                    ((or (not prmbox) (%eager-promise-box? prmbox))
    115117                      (force prm) )
    116118                    (else
    117                       (let* ((prm* (and (= 1 (length value*)) (%car value*)))
     119                      (let* ((prm* (and (= 1 (length value)) (%car value)))
    118120                             (prmbox* (and (%recursive-promise? prm*) (%promise-box prm*))) )
    119121                        (cond
     122                          ; Copy the promise to the top
    120123                          (prmbox*
    121124                            (%promise-box-tag-set! prmbox (%promise-box-tag prmbox*))
     
    124127                            (force prm) )
    125128                          (else
    126                             (apply values value*)
    127                             #;(error 'force "expected a recursive promise" value*) ) ) ) ) ) )
    128                 ; else this shouldn't happen
     129                            (error 'force "expected a recursive promise" value) ) ) ) ) ) )
     130                ; This shouldn't happen
    129131                (error 'force "expected an un-forced lazy promise" value) ) )
    130132          ; This shouldn't happen
  • release/4/srfi-45/trunk/srfi-45.scm

    r14160 r14170  
    5555  ; SRFI 45
    5656  (lazy $$finlzy)
    57   eager
     57  (eager $$finegr)
    5858  d-lay ; since we don't redefine R5RS `delay'
    5959  promise?
     
    7575
    7676(define ($$finlzy thunk) (%make-lazy-promise thunk))
     77(define ($$finegr ls) (%make-eager-promise ls))
    7778
    7879(define-syntax lazy (syntax-rules () ((_ ?expr) ($$finlzy (lambda () ?expr)))))
    79 (define (eager value) (%make-eager-promise (list value)))
    80 (define-syntax d-lay (syntax-rules () ((_ ?exp) (lazy (eager ?exp)))))
     80(define-syntax eager (syntax-rules () ((_ ?expr) ($$finegr (receive ?expr)))))
     81(define-syntax d-lay (syntax-rules () ((_ ?expr) (lazy (eager ?expr)))))
    8182
    8283;; Predicates
     
    107108            (if (%procedure? value)
    108109                ; Force the promise by invoking the thunk
    109                 (let* ((value* (receive (value)))
     110                (let* ((value (receive (value)))
    110111                       ; Re-fetch and check the top promise again in case it recursed into `force'
    111112                       (prmbox (and (%recursive-promise? prm) (%promise-box prm))) )
    112                   ; Copy the promise to the top
     113                  ;
    113114                  (cond
     115                    ; R5RS promise or Eager
    114116                    ((or (not prmbox) (%eager-promise-box? prmbox))
    115117                      (force prm) )
    116118                    (else
    117                       (let* ((prm* (and (= 1 (length value*)) (%car value*)))
     119                      (let* ((prm* (and (= 1 (length value)) (%car value)))
    118120                             (prmbox* (and (%recursive-promise? prm*) (%promise-box prm*))) )
    119121                        (cond
     122                          ; Copy the promise to the top
    120123                          (prmbox*
    121124                            (%promise-box-tag-set! prmbox (%promise-box-tag prmbox*))
     
    124127                            (force prm) )
    125128                          (else
    126                             (apply values value*)
    127                             #;(error 'force "expected a recursive promise" value*) ) ) ) ) ) )
    128                 ; else this shouldn't happen
     129                            (error 'force "expected a recursive promise" value) ) ) ) ) ) )
     130                ; This shouldn't happen
    129131                (error 'force "expected an un-forced lazy promise" value) ) )
    130132          ; This shouldn't happen
Note: See TracChangeset for help on using the changeset viewer.