Nice page Lee. One thing I'm not sure about: the difference between the consp and listp error. They seem to mean the exact same thing. Is there perhaps one scenario where consp is sent rather than listp, e.g. when a dotted pair is expected, not just a list?
Thanks Irné
Whilst writing the reference, I also attempted to ascertain the difference between the
consp &
listp argument type error messages, but as far as I can remember, I couldn't find any underlying reason why
consp is returned rather than
listp for some functions, for example:
_$ (nth 0 nil)
; error: bad argument type: consp nil
Surely this should be
listp since
nth requires a list argument, not a dotted pair?
_$ (append 'a)
; error: bad argument type: listp A
This seems logical since
append cannot accept a dotted pair argument (bad list error).
_$ (assoc 'a 'a)
; error: bad argument type: listp A
Again logical since
assoc will return a bad association list error if fed a dotted pair.
In summary:
Function Error Data Type
=================================
append listp
assoc listp
c...r consp
foreach consp
last listp
length listp
mapcar listp
member consp
nth consp
vl-every listp
vl-list->string listp
vl-list-length listp
vl-member-if listp
vl-member-if-not listp
vl-position listp
vl-remove listp
vl-remove-if listp
vl-remove-if-not listp
vl-some listp
vl-sort listp
vl-sort-i consp
foreach,
member,
nth &
vl-sort-i just don't seem to fit the pattern.