Append Method (term)

SbsSW.SwiPlCs

Copy image CopyHover image
Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog Append Method (term)
SwiPlCs interfaceSbsSW.SwiPlCsPlTermAppend(PlTerm)
Appends element to the list and make the PlTail reference point to the new variable tail. If A is a variable, and this method is called on it using the argument "gnat", a list of the form [gnat|B] is created and the PlTail object now points to the new variable B. This method returns TRUE if the unification succeeded and FALSE otherwise. No exceptions are generated.
Declaration Syntax
C# Visual Basic Visual C++ F#
public bool Append(
	PlTerm term
)
Public Function Append ( 
	term As PlTerm
) As Boolean
public:
bool Append(
	PlTerm term
)
member Append : 
        term : PlTerm -> bool 
Parameters
term (PlTerm)
The PlTerm to append on the list.
Return Value
Boolean
true if successful otherwise false
Examples
  Copy imageCopy
public void List_Append()
{
    PlTerm t = PlTerm.PlVar();
    PlTerm l = PlTerm.PlTail(t);

    Assert.IsTrue(l.Append(new PlTerm("one")), "append one");
    Assert.IsTrue(l.Append(new PlTerm("two")), "append two");
    Assert.IsTrue(l.Append(new PlTerm("three")), "append three");

    Assert.AreEqual(1, l.Close());

    Assert.AreEqual(3, list_length(t));
    Assert.AreEqual("[one,two,three]", t.ToString());
}

Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60605.0 (1.1.60605.0)