updates for changes from results of the fifth ballot

This commit is contained in:
Alex Shinn 2012-05-20 18:44:25 +09:00
parent c8f13f8538
commit c4bf82842c
7 changed files with 68 additions and 20 deletions

View file

@ -290,15 +290,15 @@
,(map (lambda (x) (list (car x) (cadr x))) (cadr expr)) ,(map (lambda (x) (list (car x) (cadr x))) (cadr expr))
,wrap))))) ,wrap)))))
(define-syntax lazy (define-syntax delay-force
(er-macro-transformer (er-macro-transformer
(lambda (expr rename compare) (lambda (expr rename compare)
`(,(rename 'make-promise) #f (,(rename 'lambda) () ,(cadr expr)))))) `(,(rename 'promise) #f (,(rename 'lambda) () ,(cadr expr))))))
(define-syntax delay (define-syntax delay
(er-macro-transformer (er-macro-transformer
(lambda (expr rename compare) (lambda (expr rename compare)
`(,(rename 'lazy) (,(rename 'make-promise) #t ,(cadr expr)))))) `(,(rename 'delay-force) (,(rename 'promise) #t ,(cadr expr))))))
(define-syntax define-auxiliary-syntax (define-syntax define-auxiliary-syntax
(er-macro-transformer (er-macro-transformer
@ -899,7 +899,7 @@
(auto-force (auto-force
) )
(else (else
(define (make-promise done? proc) (define (promise done? proc)
(list (cons done? proc))) (list (cons done? proc)))
(define (promise-done? x) (car (car x))) (define (promise-done? x) (car (car x)))
(define (promise-value x) (cdr (car x))) (define (promise-value x) (cdr (car x)))

View file

@ -12,8 +12,8 @@
(srfi 9) (srfi 11) (srfi 39)) (srfi 9) (srfi 11) (srfi 39))
(export (export
* + - ... / < <= = => > >= _ abs and append apply assoc assq assv begin * + - ... / < <= = => > >= _ abs and append apply assoc assq assv begin
binary-port? boolean? bytevector-copy bytevector-copy! binary-port? boolean? boolean=? bytevector-copy bytevector-copy!
bytevector-copy-partial bytevector-copy-partial! bytevector-length bytevector-copy-partial bytevector-length
bytevector-u8-ref bytevector-u8-set! bytevector? caar cadr bytevector-u8-ref bytevector-u8-set! bytevector? caar cadr
call-with-current-continuation call-with-port call-with-values call-with-current-continuation call-with-port call-with-values
call/cc car case cdr cdar cddr ceiling char->integer call/cc car case cdr cdar cddr ceiling char->integer
@ -23,9 +23,9 @@
define-record-type define-syntax define-values denominator do define-record-type define-syntax define-values denominator do
dynamic-wind else eof-object? eq? equal? eqv? error dynamic-wind else eof-object? eq? equal? eqv? error
error-object-irritants error-object-message error-object? even? error-object-irritants error-object-message error-object? even?
exact->inexact exact-integer-sqrt exact-integer? exact? expt floor exact exact-integer-sqrt exact-integer? exact? expt floor
flush-output-port for-each gcd get-output-bytevector get-output-string flush-output-port for-each gcd get-output-bytevector get-output-string
guard if import inexact->exact inexact? input-port? integer->char guard if import inexact inexact? input-port? integer->char
integer? lambda lcm length let let* let*-values let-syntax let-values integer? lambda lcm length let let* let*-values let-syntax let-values
letrec letrec* letrec-syntax list list->string list->vector list-copy letrec letrec* letrec-syntax list list->string list->vector list-copy
list-ref list-set! list-tail list? make-bytevector make-list list-ref list-set! list-tail list? make-bytevector make-list
@ -40,11 +40,11 @@
string->number string->symbol string->utf8 string->vector string-append string->number string->symbol string->utf8 string->vector string-append
string-copy string-fill! string-for-each string-length string-map string-copy string-fill! string-for-each string-length string-map
string-ref string-set! string<=? string<? string=? string>=? string-ref string-set! string<=? string<? string=? string>=?
string>? string? substring symbol->string symbol? syntax-error string>? string? substring symbol->string symbol? symbol=? syntax-error
syntax-rules textual-port? truncate u8-ready? unless unquote syntax-rules textual-port? truncate u8-ready? unless unquote
unquote-splicing utf8->string values vector vector->list vector->string unquote-splicing utf8->string values vector vector->list vector->string
vector-copy vector-fill! vector-for-each vector-length vector-map vector-copy vector-copy! vector-fill! vector-for-each vector-length
vector-ref vector-set! vector? when with-exception-handler vector-map vector-ref vector-set! vector? when with-exception-handler
write-bytevector write-char write-partial-bytevector write-u8 zero?) write-bytevector write-char write-partial-bytevector write-u8 zero?)
(include "define-values.scm" (include "define-values.scm"
"extras.scm" "extras.scm"

View file

@ -1,3 +1,5 @@
;; This library is deprecated, occurring in early R7RS drafts before
;; being removed.
(define-library (scheme char normalization) (define-library (scheme char normalization)
(import (rename (scheme) (import (rename (scheme)

View file

@ -1,3 +1,5 @@
;; This library is deprecated, occurring in early R7RS drafts before
;; being removed.
(define-library (scheme division) (define-library (scheme division)
(import (scheme)) (import (scheme))

View file

@ -1,4 +1,10 @@
(define exact inexact->exact)
(define inexact exact->inexact)
(define (boolean=? x y) (eq? x y))
(define (symbol=? x y) (eq? x y))
(define call/cc call-with-current-continuation) (define call/cc call-with-current-continuation)
;; Adapted from Bawden's algorithm. ;; Adapted from Bawden's algorithm.
@ -19,6 +25,8 @@
(sr (- x e) (+ x e) return)) (sr (- x e) (+ x e) return))
x)) x))
(define (square x) (* x x))
(define flush-output-port flush-output) (define flush-output-port flush-output)
(define (close-port port) (define (close-port port)
@ -98,6 +106,13 @@
(do ((i 0 (+ i 1))) ((>= i len) res) (do ((i 0 (+ i 1))) ((>= i len) res)
(vector-set! res i (vector-ref vec i))))) (vector-set! res i (vector-ref vec i)))))
(define (vector-copy! to at from . o)
(let ((start (if (pair? o) (car o) 0))
(end (if (and (pair? o) (pair? (cdr o))) (cadr o) (vector-length from))))
(do ((i at (+ i 1)) (j start (+ i 1)))
((>= j end))
(vector-set! to i (vector-ref from j)))))
(define (vector->string vec) (define (vector->string vec)
(list->string (vector->list vec))) (list->string (vector->list vec)))
@ -109,12 +124,41 @@
(bytevector-copy! bv res) (bytevector-copy! bv res)
res)) res))
(define (bytevector-copy! from to) (define (bytevector-copy! to at from . o)
(bytevector-copy-partial! from 0 (bytevector-length from) to 0)) (let ((start (if (pair? o) (car o) 0))
(end (if (and (pair? o) (pair? (cdr o)))
(cadr o)
(bytevector-length from))))
(do ((i at (+ i 1)) (j start (+ i 1)))
((>= j end))
(bytevector-u8-set! to i (bytevector-u8-ref from j)))))
(define bytevector-copy-partial subbytes) (define bytevector-copy-partial subbytes)
(define (bytevector-copy-partial! from start end to at) ;; Never use this!
(do ((i start (+ i 1))) (define (string-copy! to at from . o)
((= i end)) (let ((start (if (pair? o) (car o) 0))
(bytevector-u8-set! to (+ (- i start) at) (bytevector-u8-ref from i)))) (end (if (and (pair? o) (pair? (cdr o))) (cadr o) (string-length from))))
(do ((i at (+ i 1)) (j start (+ i 1)))
((>= j end))
(string-set! to i (string-ref from j)))))
(define truncate-quotient quotient)
(define truncate-remainder remainder)
(define (truncate/ n m)
(values (truncate-quotient n m) (truncate-remainder n m)))
(cond-expand
(ratios
(define (floor-quotient n m)
(floor (/ n m))))
(else
(define (floor-quotient n m)
(let ((res (floor (/ n m))))
(if (and (exact? n) (exact? m))
(exact res)
res)))))
(define (floor-remainder n m)
(- n (* m (floor-quotient n m))))
(define (floor/ n m)
(values (floor-quotient n m) (floor-remainder n m)))

View file

@ -1,5 +1,5 @@
(define-library (scheme lazy) (define-library (scheme lazy)
(import (scheme)) (import (scheme))
(export delay force lazy eager) (export delay force delay-force make-promise)
(begin (define (eager x) (delay x)))) (begin (define (make-promise x) (delay x))))

View file

@ -242,7 +242,7 @@ _FN0(SEXP_VOID, "print-vm-profile", 0, sexp_print_vm_profile),
#endif #endif
#if SEXP_USE_AUTO_FORCE #if SEXP_USE_AUTO_FORCE
_OP(SEXP_OPC_GENERIC, SEXP_OP_FORCE, 1, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), SEXP_FALSE, SEXP_FALSE, 0, "force", 0, NULL), _OP(SEXP_OPC_GENERIC, SEXP_OP_FORCE, 1, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), SEXP_FALSE, SEXP_FALSE, 0, "force", 0, NULL),
_FN2(_I(SEXP_PROMISE), _I(SEXP_BOOLEAN), _I(SEXP_OBJECT), "make-promise", 0, sexp_make_promise), _FN2(_I(SEXP_PROMISE), _I(SEXP_BOOLEAN), _I(SEXP_OBJECT), "promise", 0, sexp_make_promise),
#endif #endif
}; };