[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Numerical Comparison: "required coercions"
- To: Greenwald@STONY-BROOK.SCRC.Symbolics.COM, DCP@QUABBIN.SCRC.Symbolics.COM, gls@Think.COM, Moon@STONY-BROOK.SCRC.Symbolics.COM, Common-Lisp@sail.stanford.edu
- Subject: Numerical Comparison: "required coercions"
- From: Michael Greenwald <Greenwald@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Thu, 26 Mar 87 17:29 EST
- Cc: Numerics@STONY-BROOK.SCRC.Symbolics.COM
- In-reply-to: <870326133440.1.GREENWALD@SWALLOW.S4CC.Symbolics.COM>
Date: Thu, 26 Mar 87 13:34 EST
From: Michael Greenwald <Greenwald@STONY-BROOK.SCRC.Symbolics.COM>
Date: Thu, 26 Mar 87 10:47 EST
From: David C. Plummer <DCP@QUABBIN.SCRC.Symbolics.COM>
Date: Thu, 26 Mar 87 10:29 EST
From: Guy Steele <gls@Think.COM>
This issue makes me want to restate an earlier proposed model
for the comparison functions:
(? x1 x2 x3 x4 ... xn-1 xn) <=>
(AND (? x1 x2) (? x1 x3) (? x1 x4) ... (? x1 xn-1) (? x1 xn)
(? x2 x3) (? x2 x4) ... (? x2 xn-1) (? x2 xn)
(? x3 x4) ... (? x3 xn-1) (? x3 xn)
(? xn-1 xn))
where "?" may be =, /=, <, >, <=, or >=.
That is, in principle every pair of arguments is compared.
This is the model that justifies the "all different" interpretation for /=,
and it is recognized that in practice the other five operations may
be implemented cleverly through exploitation of transitivity. Well,
maybe such reliance on transitivity is wrong.
Why "maybe"? (<= 1234d10 12340000000001 1234e10 12340000000000) => T
when you depend on transitivity, but should => NIL according to the
On the other hand, SORT clearly depends on transitivity, and one might
reasonably expect (APPLY '<= (SORT SEQUENCE '<=)) => T.
(Or even more reasonably (APPLY '< (SORT SEQUENCE '<)) => T, which
unfortunately isn't true since
(SORT '(1234d10 12340000000001 1234e10 12340000000000) '<) returns the
I was wrong. The < case isn't a reasonable expectation. Mike McMahon
points out: (APPLY '< (SORT '(1 1 1 1 1 1 1) '<)). I guess I wasn't
thinking too clearly.