**equal***x y*→*generalized-boolean*

*x*- an*object*.*y*- an*object*.*generalized-boolean*- a*generalized boolean*.

Returns *true* if *x* and *y* are structurally similar (isomorphic) *objects*. *objects* are treated as follows by **equal**.

**equal** is *true* of two *objects* if they are *symbols* that are **eq**, if they are *numbers* that are **eql**, or if they are *characters* that are **eql**.

Two *arrays* are **equal** only if they are **eq**, with one exception: *strings* and *bit vectors* are compared element-by-element (using **eql**). If either *x* or *y* has a *fill pointer*, the *fill pointer* limits the number of elements examined by **equal**. Uppercase and lowercase letters in *strings* are considered by **equal** to be different.

Two *pathnames* are **equal** if and only if all the corresponding components (host, device, and so on) are equivalent. Whether or not uppercase and lowercase letters are considered equivalent in *strings* appearing in components is *implementation-dependent*. *pathnames* that are **equal** should be functionally equivalent.

Two other *objects* are **equal** only if they are **eq**.

**equal** does not descend any *objects* other than the ones explicitly specified above. The below table summarizes the information given in the previous list.

In addition, the table specifies the priority of the behavior of **equal**, with upper entries taking priority over lower ones.

Type | Behavior |
---|---|

number | uses eql |

character | uses eql |

cons | descends |

bit vector | descends |

string | descends |

pathname | "functionally equivalent" |

structure | uses eq |

Other array | uses eq |

hash table | uses eq |

Other object | uses eq |

Any two *objects* that are **eql** are also **equal**.

**equal** may fail to terminate if *x* or *y* is circular.

(equal 'a 'b)

→(equal 'a 'a)

→(equal 3 3)

→(equal 3 3.0)

→(equal 3.0 3.0)

→(equal #c(3 -4) #c(3 -4))

→(equal #c(3 -4.0) #c(3 -4))

→(equal (cons 'a 'b) (cons 'a 'c))

→(equal (cons 'a 'b) (cons 'a 'b))

→(equal #\\A #\\A)

→(equal #\\A #\\a)

→(equal "Foo" "Foo")

→(equal "Foo" (copy-seq "Foo"))

→(equal "FOO" "foo")

→(equal "This-string" "This-string")

→(equal "This-string" "this-string")

→

None.

None.

None.

*Object* equality is not a concept for which there is a uniquely determined correct algorithm. The appropriateness of an equality predicate can be judged only in the context of the needs of some particular program. Although these functions take any type of argument and their names sound very generic, **equal** and **equalp** are not appropriate for every application.

A rough rule of thumb is that two *objects* are **equal** if and only if their printed representations are the same.

\issue{EQUAL-STRUCTURE:MAYBE-STATUS-QUO} \issue{EQUAL-STRUCTURE:MAYBE-STATUS-QUO} \issue{EQUAL-STRUCTURE:MAYBE-STATUS-QUO}