From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail From: Erik Naggum Newsgroups: comp.lang.lisp Subject: Re: what is false Date: 10 Dec 2002 23:08:44 +0000 Organization: Naggum Software, Oslo, Norway Lines: 40 Message-ID: <3248550524214230@naggum.no> References: <3DF608BE.A783173B@motorola.com> <87n0ndsr9f.fsf@bird.agharta.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: maud.ifi.uio.no 1039561725 7910 129.240.65.5 (10 Dec 2002 23:08:45 GMT) X-Complaints-To: abuse@ifi.uio.no NNTP-Posting-Date: 10 Dec 2002 23:08:45 GMT Mail-Copies-To: never User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.lisp:48666 * Kent M Pitman | There as a public review comment when standardizing that came from | Boyer (of Boyer/Moore) and John McCarthy, if I recall correctly. | The committee replied that they should do exactly as you suggest. But `eq´ is not guaranteed to return a boolean. It may seem rather silly for it to return anything else, but the specification is very clear that it does not, in fact, return `t´ when it means true. So (defun same-truth-value (v1 v2) (not (not (eq (not v1) (not v2))))) will return `t´ when the two are the same truth value. Now, the much more important question is why anyone would care what the specific "true" value is. Nobody tests for anything but `nil´, anyway, and writing code that tests for any /particular/ true value is broken. Incidentally, the above function will effectively, since machine operations do not return `nil´ and `t´ but some CPU flag, be at least one conditional, so a version of `same-truth-value´ that returned a generalized boolean could also be written as (defun same-truth-value (v1 v2) (if v1 v2 (not v2))) and if a true boolean is necessary, use (and v2 t) instead of v2. In natively compiled Common Lisp implementations, this is much more efficient, too, but when expressed this way, there is seldom a need for a function for it. Also note that the standard name for this boolean operator is `eqv´, cf `logeqv´ and `boole-eqv´. -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.