Q: is there a predicate function for dotted pairs?
In other words, is there a function that distinguishes between dotted pairs and 2-element proper lists:
(some-predicate-p '(a . b)) ; => t (some-predicate-p '(a b)) ; => nil
The broader context: I need to access the second element of a pair of values, and would like the function to "do the right thing" when it's fed either a dotted pair or a 2-element proper list:
(cdr '(a . b)) ; => b (cadr '(a b)) ; => b
cadr cannot be dropped in interchangeably between proper and improper lists:
(cadr '(a . b)) ; => error (cdr '(a b)) ; => (b)