In "The Little Schemer", null is used to refer to the empty list (). But I also see the empty list referred to as nil in Scheme's Error message, e.g. doing:
(car ())
causes:
Error: Attempt to apply car on nil [car] [1]
Which sounds like it's referring to () as nil.
[1] using replit.com's BiwaScheme Interpreter version 0.6.4
This question is similar to What is the exact difference between null and null in common lisp. It is different because as the answers here point out there are differences between Common Lisp and Scheme in their treatment of nil and null.
I think that what you're seeing is an artifact of history in the error messages.
In traditional Lisps,
nilwas both the empty list and boolean false, and was rather special in various other ways (for instance, it was also a symbol, which is very weird).So in particular
()andnilare the same object in such a Lisp, and(not nil)is true, and(not '())is also true (and in fact(not ())is both legal and also true). The predicate for the empty list object isnull(perhaps should benullpbut history says it is what it is) and(null nil)is true as is(null '())and(null ()).There are also questions about what
(car nil)aka(car '())aka(car ())should do. Traditionally the answer was this was fine and(car nil)isnil. This gives you a very neat implementation ofnilif you're clever.Scheme now does away with all of this punning:
#f/#false, which is not the empty list;(not x)is true only forxbeing#f;(), which is not#fand which is therefore true;null?, so(null? '())is true, but(null? #f)is false;carandcdrof()are errors;nilis just a symbol with no special status in the language at all.I don't think that having a name for
()is standard, but obviously it might be useful to give it one, andnullis fine: Racket does that, for instance.So in Scheme,
nilis just gone, and the pun between empty lists and boolean false with it.But very many people who implement Schemes know that
nilis what people call the empty list. So when they write error messages, they writenilwhen they mean(), because that's what everyone has called()for a very long time.And that, I think, is what you are seeing here.