User Tools

A PCRE internal error occured. This might be caused by a faulty plugin


This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:eql [2019/06/15 02:00]
cl:functions:eql [2020/07/11 03:00] (current)
Line 1: Line 1:
 +====== Function EQL ======
 +  * **eql** //x y// → //​generalized-boolean//​
 +====Arguments and Values====
 +  * //x// - an //​[[CL:​Glossary:​object]]//​.
 +  * //y// - an //​[[CL:​Glossary:​object]]//​.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +The value of **eql** is //​[[CL:​Glossary:​true]]//​ of two objects, //x// and //y//, in the folowing cases: ​
 +  * 1. If //x// and //y// are **[[CL:​Functions:​eq]]**. ​
 +  * 2. If //x// and //y// are both //​[[CL:​Glossary:​numbers]]//​ of the same //​[[CL:​Glossary:​type]]//​ and the same value. ​
 +  * 3. If they are both //​[[CL:​Glossary:​characters]]//​ that represent the same character.
 +Otherwise the value of **eql** is //​[[CL:​Glossary:​false]]//​.
 +If an implementation supports positive and negative zeros as //​[[CL:​Glossary:​distinct]]//​ values, then ''​(eql 0.0 -0.0)''​ returns //​[[CL:​Glossary:​false]]//​. Otherwise, when the syntax ''​-0.0''​ is read it is interpreted as the value ''​0.0'',​ and so ''​(eql 0.0 -0.0)''​ returns //​[[CL:​Glossary:​true]]//​.
 +(eql 'a 'b) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql 'a 'a) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql 3 3) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql 3 3.0) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql 3.0 3.0) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql #c(3 -4) #c(3 -4)) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql #c(3 -4.0) #c(3 -4)) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql ([[CL:​Functions:​cons]] 'a 'b) ([[CL:​Functions:​cons]] 'a 'c)) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql ([[CL:​Functions:​cons]] 'a 'b) ([[CL:​Functions:​cons]] 'a 'b)) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql '(a . b) '(a . b)) <​r>//​[[CL:​Glossary:​true]]// ​
 +//or// //​[[CL:​Glossary:​false]]//​ </r>
 +(progn ([[CL:​Macros:​defparameter]] x ([[CL:​Functions:​cons]] 'a 'b)) ([[CL:​Functions:​eql]] x x)) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(progn ([[CL:​Macros:​defparameter]] x '(a . b)) ([[CL:​Functions:​eql]] x x)) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql #\\A #\\A) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(eql "​Foo"​ "​Foo"​) <​r>//​[[CL:​Glossary:​true]]// ​
 +//or// //​[[CL:​Glossary:​false]]//​ </r>
 +(eql "​Foo"​ ([[CL:​Functions:​copy-seq]] "​Foo"​)) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(eql "​FOO"​ "​foo"​) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +Normally ''​(eql 1.0s0 1.0d0)''​ is false, under the assumption that ''​1.0s0''​ and ''​1.0d0''​ are of distinct data types. However, implementations that do not provide four distinct floating-point formats are permitted to "​collapse"​ the four formats into some smaller number of them; in such an implementation ''​(eql 1.0s0 1.0d0)''​ might be true.
 +====Side Effects====
 +====Affected By====
 +====Exceptional Situations====
 +====See Also====
 +  * **[[CL:​Functions:​eq|Function EQ]]**
 +  * **[[CL:​Functions:​equal|Function EQUAL]]**
 +  * **[[CL:​Functions:​equalp|Function EQUALP]]**
 +  * **[[CL:​Functions:​math-equal|Function =]]**
 +  * **[[CL:​Functions:​char-equal|Function CHAR=]]**
 +**eql** is the same as **[[CL:​Functions:​eq]]**,​ except that if the arguments are //​[[CL:​Glossary:​characters]]//​ or //​[[CL:​Glossary:​numbers]]//​ of the same type then their values are compared. Thus **eql** tells whether two //​[[CL:​Glossary:​object|objects]]//​ are conceptually the same, whereas **[[CL:​Functions:​eq]]** tells whether two //​[[CL:​Glossary:​object|objects]]//​ are implementationally identical. It is for this reason that **eql**, not **[[CL:​Functions:​eq]]**,​ is the default comparison predicate for //​[[CL:​Glossary:​operators]]//​ that take //​[[CL:​Glossary:​sequences]]//​ as arguments.
 +**eql** may not be true of two //​[[CL:​Glossary:​floats]]//​ even when they represent the same value. **[[CL:​Functions:​=]]** is used to compare mathematical values.
 +Two //​[[CL:​Glossary:​complex]]//​ numbers are considered to be **eql** if their real parts are **eql** and their imaginary parts are **eql**. For example, ''​(eql #C(4 5) #C(4 5))''​ is //​[[CL:​Glossary:​true]]//​ and ''​(eql #C(4 5) #C(4.0 5.0))''​ is //​[[CL:​Glossary:​false]]//​. Note that while ''​(eql #C(5.0 0.0) 5.0)''​ is //​[[CL:​Glossary:​false]]//,​ ''​(eql #C(5 0) 5)''​ is //​[[CL:​Glossary:​true]]//​. In the case of ''​(eql #C(5.0 0.0) 5.0)''​ the two arguments are of different types, and so cannot satisfy **eql**. In the case of ''​(eql #C(5 0) 5)'',​ ''#​C(5 0)''​ is not a //​[[CL:​Glossary:​complex]]//​ number, but is automatically reduced to the //​[[CL:​Glossary:​integer]]//​ ''​5''​.