List 运行此prolog代码时显示错误

List 运行此prolog代码时显示错误,list,syntax,prolog,integer,factors,List,Syntax,Prolog,Integer,Factors,运行此prolog代码以查找数字列表的因子时出现语法错误 factors( N , Fs ) :- integer(N) , N > 0 , setof( F , ( between(1,N,F) , N mod F =:= 0 ) , Fs ) . fact(List ,Result) :- display( maplist(factors,[10 12 16],Result)) . 这不是序言中的列表: [10 12 16] 正确的书写方式如下:

运行此prolog代码以查找数字列表的因子时出现语法错误

factors( N , Fs ) :-
  integer(N) ,
  N > 0 ,  
  setof( F , ( between(1,N,F) , N mod F =:= 0 ) , Fs )
  .
fact(List ,Result) :- 
    display( maplist(factors,[10 12 16],Result))
  . 

这不是序言中的列表:

[10 12 16]
正确的书写方式如下:

[10, 12, 16]

你需要列表元素之间的逗号。

你应该考虑改进你的问题。你到底在问什么?你看到了什么?你不明白什么?