- Code: Select all
CL-USER> (listp (cons 1 2))
CL-USER> (list-length (cons 1 2))
; Evaluation aborted.
; The value 2 is not of type LIST.
; [Condition of type TYPE-ERROR]
What's inconsistent about not being able to take the length of improper lists? I don't even know why a person would try to do this intentionally, since there would be no way of guessing how the standard defined their length short of looking it up.
And of course Common Lisp doesn't error on (cons 1 2). Representing pairs is a perfectly valid use for cons cells. Not that some other functions aren't dismayingly inconsistent, but I don't see how either cons or list-length is strange.