Provide a predefined Delegate to register a C# method to be called from SWI-Prolog
Declaration Syntax
C# | Visual Basic | Visual C++ | F# |
public delegate bool DelegateParameter1( PlTerm term )
Public Delegate Function DelegateParameter1 ( term As PlTerm ) As Boolean
public delegate bool DelegateParameter1( PlTerm term )
type DelegateParameter1 = delegate of term : PlTerm -> bool
Parameters
- term (PlTerm)
Return Value
Boolean
true for succeeding otherwise false for fail
true for succeeding otherwise false for fail
Examples
See also the example in DelegateParameter2.
Copy | |
---|---|
[TestMethod] public void t_creating_a_list() { Delegate d = new DelegateParameter1(create_list); PlEngine.RegisterForeign(d); for (int i = 1; i < 10; i++) { PlTerm t = PlQuery.PlCallQuery("create_list(L)"); Assert.AreEqual("[a,b,c]", t.ToString(), "create_list failed!"); } } public static bool create_list(PlTerm list) { return list.Unify(new PlTerm("[a,b,c]")); } |
See Also
Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)