list - 运行此序言代码时显示错误
问题描述
运行此序言代码以查找数字列表的因子时显示语法错误
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))
.
解决方案
这不是 Prolog 中的列表:
[10 12 16]
正确的写法是这样的:
[10, 12, 16]
您需要列表元素之间的逗号。
推荐阅读
- python - 在 Stellargraph 中拆分用于 Node2vec 链路预测的训练测试集
- java - 如何在 jsqlparser 中验证 unpivot sql 查询?
- python - 不在 PyPI 中安装 repo
- c# - 如何最好地响应开放的 HTTP 范围请求
- xamarin.forms - 如何在 xamarin 表单中与从底部效果飞入并行制作多个控件的动画?
- mongodb - 如何在 MongoDB 中获取和使用字段名称列表?
- r - R中的S形曲线
- drupal - Drupal 8:提交表单后发送 PDF 文件
- server - 每 24 小时安排一次 python 执行
- java - Android通过程序在bottomNavigationBar中设置图标和文本的颜色失败