Why is a list with an empty list true?

I think the reason is in here:

See consult/1. I can’t be certain, but the sentence:

Abbreviation using ?- [file1,file2]. does not work for the empty list ( [] ).

probably means that this doesn’t work:

?- [].

If I read the code in init.pl correctly:

?- [[]].

becomes

?- consult(user:[]).

which calls load_files/2 which calls ‘$load_files’/3 which has the clause:

'$load_files'([], _, _) :- !.

which is why ?- [[]]. succeeds without choice points.

This is the “what happens”. The answer to “why” is beyond me.

2 Likes