运行此序言代码时显示错误

时间:2021-01-22 06:47:43

标签: list syntax prolog integer factors

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

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))
  . 

1 个答案:

答案 0 :(得分:1)

这不是 Prolog 中的列表:

[10 12 16]

正确的写法是这样的:

[10, 12, 16]

列表元素之间需要逗号。

相关问题