Issue BUTLAST-DOTTED-LIST
Issue: BUTLAST-DOTTED-LIST

Forum: Editorial

References: BUTLAST, NBUTLAST

Category: CLARIFICATION/CHANGE

Edit history: 2004-06-10, Version 1 by Lars Brinkhoff

Status: For CLiki consideration

Problem Description:

The description of BUTLAST and NBUTLAST isn't self-consistent when applied to dotted list.

Proposal (BUTLAST-DOTTED-LIST:OMIT-CONSES):

The specified number of cons cells at the end of the list should be removed.

Proposal (BUTLAST-DOTTED-LIST:RPLACD-TO-NIL):

Set the cdr of the cons n+1 from the end of the list to nil.

Test case:

(butlast '(a b . c) 0)

Rationale:

Mostly this precludes implementations from arbitraily adopting one of the two possible interpretations.

Current practice:

(butlast '(a b . c) 0) returns (a b) in CLISP 2.32 and CMUCL release-18e-branch but (a b . c) in SBCL 0.8.9.46.

Cost to Implementors:

Small.

Cost to Users:

None. Portable programs cannot currently rely on any particular behavior.

Cost of Non-Adoption:

Users would be confused about what to expect because implementations might implement either of the two behaviours.

Benefits:

Tighter spec.

Aesthetics:

Discussion: