In Lisp, equality can be interpreted different ways. For instance, the character "a" is a concept that can be represented by several different glyphs – A, a, a – which can be considered identical or not, depending on the predicate. These predicates are not available in the menus : their name must be typed directly in a patch editor.
There are four equality test predicates :
The eq and eql predicates are the strictest, the equal and equalp are the most open predicates, and are relevant to most cases.
Returns "t" with |
Examples | |
---|---|---|
|
identical objects with the same reference integers and ratios of same value glyphs representing the same character -> "nil" : strings, lists, floats, ratios that produce floats. |
eq A A -> t eq 2 2/1 -> t eq A a -> t eq "A" "A" -> nil eq (A B C) (A B C) -> nil eq 2.5 2.5 -> nil |
Returns "t" with |
Examples | |
|
eq or eql objects structurally similar objects strings with identical glyphs floats of same value |
equal (A (b) C) (a (B) c) -> t equal "A" "A" -> t equal "A" "a" ->nil equal 2.5 2.5 ->t |
Returns "t" with |
Examples | |
|
eq, eql or equal objects strings with similar glyphs numbers of same numerical value |
equalp "A" "a" -> t equalp 2 2/1 -> t equalp 2.5 2.5 -> t equalp 2 2.0 -> t |
Many Lisp and OM functions need a predicate to operate.
Functions that perform operations upon lists, for instance, have a default equality predicate used for identifying similar items in two different lists, and manipulate them. Note that this predicate can be redefined to modify the behaviour of the function.