标签: yap

尝试在OS X中使用JPL和YAP Prolog时抛出异常

我正在尝试使用JPL进行Java程序和YAP Prolog的交互.

在我的java文件中,这一行抛出异常:

Query query = new Query("consult", new Term[] { new Atom("test.pl") });

例外如下所示:

Exception in thread "main" jpl.JPLException: this Query's engine is not that which is attached to this thread
at jpl.Query.close(Query.java:511)
at jpl.Util.textToTerm(Util.java:165)
at jpl.Query.Query1(Query.java:183)
at jpl.Query.<init>(Query.java:176)
at Test.main(Test.java:12)
Run Code Online (Sandbox Code Playgroud)

虽然我没有在YAP中发现有人报告同样的问题,但是有些人在SWI中遇到了这个问题,并建议他们验证SWI是使用多线程支持编译的.以防我编译YAP支持多线程,但它没有帮助.

这个问题只发生在OS X中,我在Ubuntu中尝试过,一切正常.

有人知道OS X中此问题的解决方法吗?

java prolog jpl yap

17
推荐指数
1
解决办法
631
查看次数

GMP pow中的溢出处理

(我只是主要通过的GMP库的间接用户.但我对解决这个问题非常感兴趣.)

当使用可笑的大值执行取幂时,主机系统或GMP不再能够适当地处理溢出.我已经与上述系统的开发人员进行了交谈,但他们没有看到一个简单的解决方案.

这个问题是否为其他GMP系统/用户所知?你如何处理这种溢出?

作为一个完整性检查首先测试7 ^ 7 ^ 7的值应该是:375982 ... 32343

例如,在32位系统上,查询会?- X is 13^1150000000.产生这样的溢出.以下是YAP给出的内容:

GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please …

c biginteger gmp swi-prolog yap

7
推荐指数
2
解决办法
1429
查看次数

差异yap和swi-prolog阅读规范列表

我有以下测试代码试图将文件读入列表

open('raw250-split1.pl', read, Stream),
read(Stream,train_xs(TrainXs)),
length(TrainXs, MaxTrain).
Run Code Online (Sandbox Code Playgroud)

由于文件非常大,我将省略部分输出.

它运作良好yap,

?  chill git:(master) ? yap                                                      [18/06/19| 5:48PM]
% Restoring file /usr/lib/Yap/startup.yss
YAP 6.2.2 (x86_64-linux): Sat Sep 17 13:59:03 UTC 2016
   ?- open('raw250-split1.pl', read, Stream),                                                           
      read(Stream, train_xs(TrainXs)),                                                                     
      length(TrainXs, MaxTrain).
MaxTrain = 225,
Stream = '$stream'(3),
TrainXs = [[parse([which,rivers,run,through,states,bordering,new,mexico,/],answer(_A,(river(_A),traverse(_A,_B),next_to(_B,_C),const(_C,stateid('new mexico')))))],
<omited output>
,[parse([what,is,the,largest,state,capital,in,population,?],answer(_ST,largest(_SU,(capital(_ST),population(_ST,_SU)))))]]
Run Code Online (Sandbox Code Playgroud)

但是swi-prolog,它会产生Type error

?  chill git:(master) ? swipl                                                     [18/06/19| 7:24PM]
Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is …
Run Code Online (Sandbox Code Playgroud)

file prolog swi-prolog yap

5
推荐指数
1
解决办法
116
查看次数

标签 统计

yap ×3

prolog ×2

swi-prolog ×2

biginteger ×1

c ×1

file ×1

gmp ×1

java ×1

jpl ×1