From cefec1275615777708de5e8745eed49526210b29 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 2 Nov 2013 22:30:40 +0900 Subject: [PATCH] =?UTF-8?q?Making=20boolean=3D=3F=20and=20symbol=3D=3F=20n?= =?UTF-8?q?-ary.=20Fixes=20issue=20#204.?= --- lib/scheme/extras.scm | 6 ++++-- tests/r7rs-tests.scm | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/scheme/extras.scm b/lib/scheme/extras.scm index 05717b4b..2e168122 100644 --- a/lib/scheme/extras.scm +++ b/lib/scheme/extras.scm @@ -34,8 +34,10 @@ (define exact inexact->exact) (define inexact exact->inexact) -(define (boolean=? x y) (eq? x y)) -(define (symbol=? x y) (eq? x y)) +(define (boolean=? x y . o) + (and (eq? x y) (if (pair? o) (apply boolean=? y o) #t))) +(define (symbol=? x y . o) + (and (eq? x y) (if (pair? o) (apply symbol=? y o) #t))) (define call/cc call-with-current-continuation) diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 4f865056..f0fc7678 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -801,6 +801,8 @@ (test #t (boolean=? #t #t)) (test #t (boolean=? #f #f)) (test #f (boolean=? #t #f)) +(test #t (boolean=? #f #f #f)) +(test #f (boolean=? #t #t #f)) (test-end) @@ -916,6 +918,8 @@ (test #t (symbol=? 'a 'a)) (test #f (symbol=? 'a 'A)) +(test #t (symbol=? 'a 'a 'a)) +(test #f (symbol=? 'a 'a 'A)) (test "flying-fish" (symbol->string 'flying-fish))