) or a compound term with name‘
’127The traditional list functor name is the dot (
’.'). This is still the case of the command line option --traditional is given. See also section 5.1. and arity 2 and the second argument is a list.128In versions before 5.0.1, is_list/1 just checked for
[_|_]and proper_list/1 had the role of the current is_list/1. The current definition conforms to the de facto standard. Assuming proper coding standards, there should only be very few cases where a quick-and-dirty is_list/1 is a good choice. Richard O'Keefe pointed at this issue. This predicate acts as if defined by the definition below on acyclic terms. The implementation safely fails if Term represents a cyclic list.
is_list(X) :- var(X), !, fail. is_list(). is_list([_|T]) :- is_list(T).