Test if array is inside a list in lisp

The Answer

Your sequence functions marked “returns NIL” will return T if you pass :test #'equalp to them.

The Reason

The default Two-Argument Test in Common Lisp is eql.

It is the most reasonable choice between the 4(!) general purpose comparison functions provided for by the ANSI CL standard:

  • eq is too implementation-dependent and does not work as one probably wants on numbers and characters

  • equal and equalp traverse objects and thus take long time for huge ones and may never terminate for circular ones.

See also the difference between eq, eql, equal, and equalp in Common Lisp.

Leave a Comment