Subject: Re: Abuse of defvar??
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 04 Apr 2005 03:29:07 -0500
Newsgroups: comp.lang.lisp
Message-ID: <B4qdnQucPqBOZ83fRVn-uQ@speakeasy.net>
Kalle Olavi Niemitalo  <kon@iki.fi> wrote:
+---------------
| Kent M Pitman <pitman@nhplace.com> writes:
| >    ;; please don't use MOD since i=16 is SURELY an error
| >    (check-type i (integer 0 15) "the integer value of a hex digit")
| >    (svref +hex-chars+ i))
| 
| Do you mean the MOD function?  I think the MOD type specifier
| would be quite appropriate here.
+---------------

While type (MOD 16) is by definition [CLHS "Type Specifier MOD"]
exactly equivalent to (INTEGER 0 15), in this case I think it gives
the wrong connotation to the reader of the code. The latter form
more clearly identifies this as a range check.  IMHO...


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607