From 29c3ebf99a3567ba9f94a050e862203bec41f7fc Mon Sep 17 00:00:00 2001 From: shivers Date: Sat, 2 May 1998 17:13:09 +0000 Subject: [PATCH] Simplified optional arg handling a bit. --- scsh/select.scm | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/scsh/select.scm b/scsh/select.scm index bdc5a7d..8f12b4e 100644 --- a/scsh/select.scm +++ b/scsh/select.scm @@ -33,16 +33,11 @@ (define (select!/copyback/errno read-vec write-vec exception-vec . maybe-timeout) - (let ((timeout (and (pair? maybe-timeout) - (if (pair? (cdr maybe-timeout)) - (apply error "Too many arguments" - select!/copyback/errno - read-vec write-vec exception-vec - maybe-timeout) - (real->exact-integer (check-arg real? - (car maybe-timeout) - select!/copyback/errno))))) - + (let* ((timeout (:optional maybe-timeout #f)) + (timeout (and timeout + (real->exact-integer (check-arg real? + timeout + select!/copyback/errno)))) (vec-ok? (lambda (v) (vector-every? (lambda (elt) (or (and (integer? elt) (>= elt 0)) @@ -95,16 +90,11 @@ (values nr nw ne)))) (define (select!/errno read-vec write-vec exception-vec . maybe-timeout) - (let ((timeout (and (pair? maybe-timeout) - (if (pair? (cdr maybe-timeout)) - (apply error "Too many arguments" - select!/copyback/errno - read-vec write-vec exception-vec - maybe-timeout) - (real->exact-integer (check-arg real? - (car maybe-timeout) - select!/copyback/errno))))) - + (let* ((timeout (:optional maybe-timeout #f)) + (timeout (and timeout + (real->exact-integer (check-arg real? + timeout + select!/copyback/errno)))) (vec-ok? (lambda (v) (vector-every? (lambda (elt) (or (and (integer? elt) (>= elt 0))