Subject: Re: predicates and generalized booleans
From: Erik Naggum <erik@naggum.no>
Date: 1997/04/09
Newsgroups: comp.lang.lisp
Message-ID: <3069618707327233@naggum.no>


* Kent Pitman
| You've chided me too much on SGML style issues for the HyperSpec for me
| to let a comment like this pass without comment. ;-): You should do "in
| practice" what will keep your programs from breaking if you meat a new
| implementation.

(I deserved this.)

| Heh.  You had to ask...

and I'm truly happy I did, too.  thank you for a very informative answer.

| And, personally, I think relying on the identity of a truth value
| function as being the arbitrarily chosen object T is stylistically poor.

that was the weak hunch that prompted the question.  I've cleaned it up,
and now it's a separate function with a slight change to the semantics (a
substring entirely without contents (i.e., empty or whitespace only) causes
the returned value to be t; a complete object if that object is readable;
otherwise, a cons of an error condition and the appropriate literal:

    (flet ((parse-argument (start end)
	     (handler-case
		 (read-from-string buffer nil t
		   :start start
		   :end end)
	       (stream-error (eof)
		 (cons eof (make-array (- end start)
			     :element-type (array-element-type buffer)
			     :displaced-to buffer
			     :displaced-index-offset start)))))))

weird thing is, I think this has elegance, too.

#\Erik
-- 
I'm no longer young enough to know everything.