我怎么能打印这串在序言中的最好的方式:
predicate([], L, Id, L2):-
length(L2, N),
write('The length '),
write(Id),
write(' is '),
write(N),
write(' elements.'),
nl.
我怎么能打印这串在序言中的最好的方式:
predicate([], L, Id, L2):-
length(L2, N),
write('The length '),
write(Id),
write(' is '),
write(N),
write(' elements.'),
nl.
在SWI序言中,你可以使用内谓 的格式/2:
predicate([], L, Id, L2):-
length(L2, N),
format('The length of ~w is ~w elements\n', [Id, N]).