This is the generic-comparability Reference Manual, version 1.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 18:14:03 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
generic-comparability
CDR-8 implementation
Paul Nathan
LLGPL
1.0.1
alexandria
(system).
generic-comparability.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
generic-comparability/generic-comparability.asd
generic-comparability
(system).
generic-comparability/generic-comparability.lisp
generic-comparability
(system).
compare
(generic function).
equals
(generic function).
gt
(generic function).
gte
(generic function).
hash-code
(generic function).
incomparable-object
(function).
incomparable-object
(condition).
lt
(generic function).
lte
(generic function).
print-object
(method).
value1
(reader method).
(setf value1)
(writer method).
value2
(reader method).
(setf value2)
(writer method).
Packages are listed by definition order.
generic-comparability
alexandria
.
common-lisp
.
compare
(generic function).
equals
(generic function).
greaterp
(generic function).
gt
(generic function).
gte
(generic function).
hash-code
(generic function).
incomparable-object
(function).
incomparable-object
(condition).
lessp
(generic function).
lt
(generic function).
lte
(generic function).
not-greaterp
(generic function).
not-lessp
(generic function).
value1
(generic reader).
(setf value1)
(generic writer).
value2
(generic reader).
(setf value2)
(generic writer).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The generic function COMPARE defines methods to
test the ordering of two objects a and b, if such order exists. The
result value returned by COMPARE is one of the four symbols: :<, :>,
:=, or :/=. The COMPARE function returns :/= as result by default; thus
it can represent partial orders among objects. The equality tests
should be coherent with what the generic function EQUALS does.
If the argument recursive is T, then COMPARE may recurse down the ‘structure‘ of a and b. The description of each known method contains the relevant information about its recursive dependent behavior.
string
) (b string
) &rest keys &key case-sensitive) ¶character
) (b character
) &rest keys &key case-sensitive) ¶symbol
) (b symbol
) &rest keys) ¶number
) (b number
) &rest keys) ¶a b – Common Lisp objects.
recursive – a generalized boolean; default is NIL.
result – a boolean.
keys – a list (as per the usual behavior).
by-key – a generalized boolean; default is T.
by-values – a generalized boolean; default is T.
check-properties – a generalized boolean; default is NIL.
case-sensitive – a generalized boolean; default is T.
Description:
The EQUALS generic functions defines methods to test for ‘equality‘ of two objects a and b. When two objects a and b are EQUALS under an appropriate and context-dependent notion of ‘equality‘, then the function returns T as result; otherwise EQUALS returns NIL as result.
If the argument recursive is T, then EQUALS may recurse down the
‘structure‘ of a and b. The description of each known method contains
the relevant information about its recursive dependent behavior.
EQUALS provides some default behavior, but it is intended mostly as a hook for users. As such, it is allowed to add keyword arguments to user-defined EQUALS methods, as the &key and &allow-other-keys lambda-list markers imply.
array
) (b array
) &rest keys &key recursive &allow-other-keys) ¶EQUALS array array &key recursive
This implements a straightforward comparison element by element of the array.
hash-table
) (b hash-table
) &rest keys &key recursive by-key by-value check-properties &allow-other-keys) ¶EQUALS hash-table hash-table &key recursive (by-key t) (by-value t) (check-properties t)
by-key implies checking hash table keys for equality
by-value implies checking hash table values for equality
check-properties implies checking both hash-table-rehash-size and
hash-table rehash-threshhold.
This is expensive: O( 2 * n * (time-of-key-comparison + time-of-value-comparison)).
standard-object
) (b standard-object
) &rest keys) ¶structure-object
) (b structure-object
) &rest keys &key reference-equality) ¶string
) (b string
) &rest keys &key case-sensitive) ¶character
) (b character
) &rest keys &key case-sensitive) ¶cons
) (b cons
) &rest keys) ¶number
) (b number
) &rest keys) ¶float
) (b float
) &rest keys &key floating-compare max-relative-diff) ¶EQUALS float float &key (floating-compare nil) (max-relative-diff 1.19e7)
If floating-compare is true, then the floating comparison algorithm is used, as opposed to ‘=‘.
The floating comparison is derived from here:
http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
The Internet Archive has a copy of this URL.
The implemented algorithm is AlmostEqualRelative. It is not the best
possible float equality algorithm, but is simple and
understandable (and easy to code). Improvements with citations from
the literature are welcome.
Observe the following comparison and beware:
CL-USER> (equals 1.0 1.0000001 :floating-compare t)
NIL
CL-USER> (equals 1.0 1.00000001 :floating-compare t)
T
gt
.
The HASH-CODE generic function is provided as a
companion to EQUALS for the benefit of those Common Lisp
implementations that provide a handle on the inner working of hash
tables (usually in the form of an extra :sxhash or :hash-function
keyword argument to make-hash-table), or for bottom-up hash table
implementations.
HASH-CODE is modeled after the Java hashCode() method of
java.lang.Object. The same description applies almost unchanged.
The general contract of HASH-CODE is the following.
Whenever it is invoked on the same object more than once during an a Common Lisp session, the HASH-CODE generic function must consistently return the same fixnum, provided no information used in EQUALS comparisons on the object a is modified. This integer need not remain consistent from one Common Lisp session to another. If two objects are equal according to the EQUALS generic predicate, then calling the HASH-CODE generic function on each of the two objects must produce the same integer result. It is not required that if two objects are unequal according to the EQUALS generic predicate, then calling the HASH-CODE generic function on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.
The generic hash-code implementation defaults to SXHASH of the value passed in.
lte
.
gte
.
incomparable-object
)) ¶incomparable-object
)) ¶incomparable-object
)) ¶incomparable-object
)) ¶Jump to: | (
C E F G H I L M N P V |
---|
Jump to: | (
C E F G H I L M N P V |
---|
Jump to: | S V |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
S | |||
Slot, value1 : | Public conditions | ||
Slot, value2 : | Public conditions | ||
| |||
V | |||
value1 : | Public conditions | ||
value2 : | Public conditions | ||
|
Jump to: | S V |
---|
Jump to: | C F G I P S |
---|
Jump to: | C F G I P S |
---|