2016-02-08 90 views
1

我在我的Mac上運行XSB Prolog(El Capitan 10.11.2): XSB版本3.6。 (Gazpatcho)2015年4月22日 [i386-apple-darwin15.2.0 64位;模式:最佳;引擎:slg-wam;調度:本地] [生產日期:2016年1月17日]XSB Prolog meta解釋器與clpr約束問題

我使用的CLPR包,並希望寫一個小元解釋:

:- [clpr]. 
try((G1,G2)):- !, try(G1), try(G2). 
try((G1; G2)):- !, try(G1); try (G2). 
try(true):- !. 
try({X}):- !, {X}. 
try(G):- clause(G, Body), try(Body). 

然而,try({X=1+2})不工作 - 它不符合第四條款,並下降到第五條款。

任何想法爲什麼?

回答

0

嗯,看來,如果一個加載文件包含代碼load_dyn(test)代碼的作品。 (如果我只是諮詢文件,它不工作,即與[test]加載

0

這確實是奇怪如果您reconsult你的代碼兩次,然後你得到預期的結果:。

XSB Version 3.6. (Gazpatcho) of April 22, 2015 
[i386-apple-darwin15.3.0 64 bits; mode: optimal; engine: slg-wam; scheduling: local] 
[Build date: 2016-02-07] 

| ?- reconsult(xsbb). 
[xsbb loaded] 
[clpr loaded] 
[dump loaded, cpu time used: 0.0010 seconds] 
[itf loaded] 
[geler loaded] 
[class loaded] 

yes 
| ?- reconsult(xsbb). 
[xsbb loaded] 
[clpr loaded, cpu time used: 0.0010 seconds] 
[dump loaded] 
[itf loaded] 
++Warning[XSB]: [Runtime/P] replacing previous verify_attribute_handler for module itf 
[geler loaded] 
++Warning[XSB]: [Runtime/P] replacing previous verify_attribute_handler for module geler 
[class loaded] 
++Warning[XSB]: [Runtime/P] replacing previous verify_attribute_handler for module class 
++Warning[XSB]: [Runtime/P] replacing previous constraint_portray_hook for module clpr 

yes 
| ?- try({X=1+2}). 

X = 3.0000 

yes