Strange Behavior: functions not work for a list/cons
Posted: Mon Mar 12, 2012 8:00 pm
For this form
(cons 'a (cons 'chicken 'cat))
(consp (cons 'a (cons 'chicken 'cat))) returns T
(listp (cons 'a (cons 'chicken 'cat))) returns T
(list-length (cons 'a (cons 'chicken 'cat))) throws error CAT is not of type list
nth 0, nth 1 works but nth 2 gives the same error
It seems contradictory to me: if the form is a list as shown by listp function call, it should have a length or at least the length function should return meaningful value instead of throw a type condition.

(cons 'a (cons 'chicken 'cat))
(consp (cons 'a (cons 'chicken 'cat))) returns T
(listp (cons 'a (cons 'chicken 'cat))) returns T
(list-length (cons 'a (cons 'chicken 'cat))) throws error CAT is not of type list
nth 0, nth 1 works but nth 2 gives the same error
It seems contradictory to me: if the form is a list as shown by listp function call, it should have a length or at least the length function should return meaningful value instead of throw a type condition.
