When exploring the built-in predicates, Beginning LISPers (in ANSI Common LISP esp.) will often get the following doubt:
Aren't consp & listp the same?
Short answer : No
Why is that?
Well, because not every list is a cons-cell !
What? Can you please explain?
NIL is a list, also denoted by
But (most importantly!)
NIL is not a cons-cell.
I hope you 'got' the subtle difference between
listp predicates in LISP.
It should now be clear what the following code snippets produce (Please do try!) :
Note: This pro-tip gives a very compact explanation. For a more detailed write-up, please refer to my detailed article here