Append Method (term)

SWI-Prolog SbsSW.SwiPlCs

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++
public bool Append(
	PlTerm term
)
Public Function Append ( _
	term As PlTerm _
) As Boolean
public:
bool Append(
	PlTerm term
)
Parameters
term (PlTerm)
The PlTerm to append on the list.
Return Value
true if successful otherwise false
Examples
CopyC#
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) Version: 1.1.60301.0 (1.1.60301.0)