?- foo(hello, X) =.. List. List = [foo, hello, X] ?- Term =.. [baz, foo(1)]. Term = baz(foo(1))
SWI-Prolog also supports terms with arity 0, as in a()
(see
section 5). Such terms
must be processed using
compound_name_arguments/3.
This predicate raises a domain error as shown below. See also functor/3.
?- a() =.. L. ERROR: Domain error: `compound_non_zero_arity' expected, found `a()'