Issue EQUAL-CIRCULAR-LIST
Issue: EQUAL-CIRCULAR-LIST

Forum: Editorial

References: EQUAL

Category: CLARIFICATION/CHANGE

Edit history: 2004-07-20, Version 1 by Bruno Haible

Status: For CLiki consideration

Problem Description:

Under CLHS rules, (EQUAL proper-list circular-list) may fail to terminate, but in all known implementation it will terminate

Proposal (EQUAL-CIRCULAR-LIST:ALLOW):

Change "EQUAL may fail to terminate if x or y is circular" to "if x and y are circular", so that (equal t '#1=(nil #1#)) is required to terminate.

Test case:

(equal '(a b c) '#1=(a b . #1#))

Rationale:

All reasonable implementations of EQUAL behave this way.

Current practice:

SBCL and CLISP implement ALLOW.

Cost to Implementors:

None.

Cost to Users:

None.

Cost of Non-Adoption:

Users who assume a normal recursive implementation of EQUAL are trapped into pitfalls.

Benefits:

Legalize existing practice.

Aesthetics:

Discussion:
  • Bruno Haible says: I agree with proposal ALLOW. It is common practice to use (equal proper-list circular-list). The standard should allow it.