fix R6RS boolean=? and symbol=?

svn: r12456
This commit is contained in:
Matthew Flatt 2008-11-15 13:42:11 +00:00
parent 1d35333026
commit c0fb0086e9
2 changed files with 22 additions and 2 deletions

View File

@ -76,7 +76,7 @@
[r6rs:string->number string->number]) [r6rs:string->number string->number])
;; 11.8 ;; 11.8
not boolean? boolean=? not boolean? (rename-out [r6rs:boolean=? boolean=?])
;; 11.9 ;; 11.9
(rename-out [r5rs:pair? pair?] (rename-out [r5rs:pair? pair?]
@ -123,7 +123,7 @@
[r5rs:for-each for-each]) [r5rs:for-each for-each])
;; 11.10 ;; 11.10
symbol? symbol=? symbol? (rename-out [r6rs:symbol=? symbol=?])
string->symbol symbol->string string->symbol symbol->string
;; 11.11 ;; 11.11
@ -349,6 +349,22 @@
(and (regexp-match? rx:number s) (and (regexp-match? rx:number s)
(string->number (regexp-replace* #rx"[|][0-9]+" s ""))))) (string->number (regexp-replace* #rx"[|][0-9]+" s "")))))
(define r6rs:symbol=?
(case-lambda
[(a b) (symbol=? a b)]
[(a b . rest) (and (symbol=? a b)
(andmap (lambda (s)
(symbol=? a s))
rest))]))
(define r6rs:boolean=?
(case-lambda
[(a b) (boolean=? a b)]
[(a b . rest) (and (boolean=? a b)
(andmap (lambda (s)
(boolean=? a s))
rest))]))
(define-syntax-rule (make-mapper what for for-each in-val val-length val->list list->result) (define-syntax-rule (make-mapper what for for-each in-val val-length val->list list->result)
(case-lambda (case-lambda
[(proc val) (list->result [(proc val) (list->result

View File

@ -1005,6 +1005,8 @@
(test (boolean=? #t #t) #t) (test (boolean=? #t #t) #t)
(test (boolean=? #t #f) #f) (test (boolean=? #t #f) #f)
(test (boolean=? #f #t) #f) (test (boolean=? #f #t) #f)
(test (boolean=? #t #t #f) #f)
(test (boolean=? #t #t #t #t) #t)
;; 11.9 ;; 11.9
(test (pair? '(a . b)) #t) (test (pair? '(a . b)) #t)
@ -1126,6 +1128,8 @@
(test (symbol=? 'a 'a) #t) (test (symbol=? 'a 'a) #t)
(test (symbol=? 'a 'A) #f) (test (symbol=? 'a 'A) #f)
(test (symbol=? 'a 'b) #f) (test (symbol=? 'a 'b) #f)
(test (symbol=? 'a 'a 'b) #f)
(test (symbol=? 'a 'a 'a 'a) #t)
(test (symbol->string 'flying-fish) (test (symbol->string 'flying-fish)
"flying-fish") "flying-fish")