开发者

Prolog.NET: backtracing and arrays

I apologize for wasting your time, but I am stucked :/ I read the manual few times but I still have got few questions about developing in Prolog.Net (http://prolog.hodroj.net/ version).

  • How to get all possible answers to query? eg. for database
f(a, 20).
f(a, 30).
f(a, 40).
f(b, 20).

f(a, X). should return [20, 30, 40]. I tried Redo() method, but it didn't worked for me.

  • How to use arrays in queries? Code like this
AbstractTerm a = new AbstractTerm();
AbstractTerm b = new AbstractTerm();
ArrayList开发者_如何学编程 c = new ArrayList(symptomsConfirmed.ToArray());
ArrayList d = new ArrayList(symptomsDenied.ToArray());
database.q(a, c, d, b);

cause InvalidCastException (Cannot convert from 'System.Collections.ArrayList' to 'Axiom.Runtime.AbstractTerm'.)

I would be very thankful for any help. MSM.


Check the signature of the q method and I'll bet the second and third parameters are of the Axiom.Runtime.AbstractTerm type, not System.Collections.ArrayList type. database.q(a, c, d, b) is likely where the exception is being thrown because it is expecting AbstractTerms, where you send in variables c and d (ArrayLists).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜