Up | Next | Prev | PrevTail | Tail |

There are two classes of equality in LISP, eq and equal, in REDUCE written as the infix operators eq, and equal sign = respectively. As symbols are unique, both are equivalent for them: if symbols are equal, they are eq.

u := ′a;v := ′a; ueq v ⇒ t

here the variables u and v represent the same symbol and consequently they are eq.

For lists, things are different. Here we must distinguish between references to pairs which contain the same contents (“equal”) or references to the same identical pair instance(“eq”). A pair is eq to itself only, but it is equal to a different pair if their cars and cdrs are equal - this is a recursive definition. Example:

u := {1,2};v := {1,2};w := u;

u = v ⇒ t ,u = w ⇒ t

u eq v ⇒ nil, u eq w ⇒ t

Here u, v and w have as values pairs with same cars and equal cdrs, but only u and w refer to the identical pair because for v fresh pairs have been built. In some points REDUCE relies on identity of some structures, e.g. for composite kernels of standard forms.

Up | Next | Prev | PrevTail | Front |