From 0d9e517216a1e0f2b1ca11e6eb3c7e660d58823c Mon Sep 17 00:00:00 2001 From: Arthur Gleckler Date: Thu, 18 Jul 1991 23:37:33 +0000 Subject: [PATCH] Fix the pluralization of "argument" in the WRONG-NUMBER-OF-ARGUMENTS error. --- v7/src/runtime/error.scm | 55 ++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/v7/src/runtime/error.scm b/v7/src/runtime/error.scm index 54ac30955..0bbae9e0c 100644 --- a/v7/src/runtime/error.scm +++ b/v7/src/runtime/error.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/error.scm,v 14.15 1991/07/15 23:56:28 arthur Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/error.scm,v 14.16 1991/07/18 23:37:33 arthur Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -709,27 +709,38 @@ MIT in each case. |# condition-type:wrong-type-datum '(OPERANDS) (lambda (condition port) - (write-string "The procedure " port) - (write-operator (access-condition condition 'DATUM) port) - (write-string " has been called with " port) - (write (length (access-condition condition 'OPERANDS)) port) - (write-string " arguments; it requires " port) - (let ((arity (access-condition condition 'TYPE))) - (cond ((not (pair? arity)) - (write-string "exactly " port) - (write arity port)) - ((not (cdr arity)) - (write-string "at least " port) - (write (car arity) port)) - ((= (car arity) (cdr arity)) - (write-string "exactly " port) - (write (car arity) port)) - (else - (write-string "between " port) - (write (car arity) port) - (write-string " and " port) - (write (cdr arity) port)))) - (write-string " arguments." port)))) + (let ((pluralize-argument + (lambda (number) + (write-string + (if (= number 1) " argument" " arguments") + port)))) + (write-string "The procedure " port) + (write-operator (access-condition condition 'DATUM) port) + (write-string " has been called with " port) + (let ((count (length (access-condition condition 'OPERANDS)))) + (write count port) + (pluralize-argument count)) + (write-string "; it requires " port) + (let ((arity (access-condition condition 'TYPE))) + (cond ((not (pair? arity)) + (write-string "exactly " port) + (write arity port) + (pluralize-argument arity)) + ((not (cdr arity)) + (write-string "at least " port) + (write (car arity) port) + (pluralize-argument (car arity))) + ((= (car arity) (cdr arity)) + (write-string "exactly " port) + (write (car arity) port) + (pluralize-argument (car arity))) + (else + (write-string "between " port) + (write (car arity) port) + (write-string " and " port) + (write (cdr arity) port) + (write-string " arguments" port)))) + (write-char #\. port))))) (set! condition-type:control-error (make-condition-type 'CONTROL-ERROR condition-type:error '() -- 2.25.1