PlTerm Structure

SWI-Prolog SbsSW.SwiPlCs

Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog PlTerm Structure
SwiPlCs interfaceSbsSW.SwiPlCsPlTerm

The PlTerm struct plays a central role in conversion and operating on Prolog data.

PlTerm implements IComparable to support ordering in [!:System.Linq] queries if PlTerm is a List.

Creating a PlTerm can be done by the Constructors or by the following static methods:

PlVar(), PlTail(), PlCompound, PlString(), PlCodeList(), PlCharList() (see remarks)

Declaration Syntax
C# Visual Basic Visual C++
public struct PlTerm : IComparable, IEnumerable<PlTerm>, 
	IEnumerable
Public Structure PlTerm _
	Implements IComparable, IEnumerable(Of PlTerm),  _
	IEnumerable
public value class PlTerm : IComparable, 
	IEnumerable<PlTerm>, IEnumerable
Members
All Members Constructors Methods Properties



Icon Member Description
PlTerm(String)
Creates a term-references holding a Prolog term representing text.

PlTerm(Int32)
Creates a term-references holding a Prolog integer representing value.

PlTerm(Double)
Creates a term-references holding a Prolog float representing value.

Add(PlTerm)
Appends an element to a list by creating a new one and copy all elements Note This is a slow version see my mail from Jan from 2007.11.06 14:44

AddList(PlTerm)
Appends a list ( PlTail ) to a list by creating a new one and copy all elements

Append(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.

Arity

Get the arity of the functor if PlTerm is a compound term.


Close()()()()
Unifies the term with [] and returns the result of the unification.

CompareTo(Object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Equality(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Equality(PlTerm, Int32)
Equality(Int32, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Equality(PlTerm, String)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Equality(String, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Equals(Object)
Indicates whether this instance and a specified object are equal.
(Overrides ValueType.Equals(Object).)
ExplicitNarrowingExplicitExplicitExplicit(PlTerm to String)
Converts the Prolog argument into a string which implies Prolog atoms and strings are converted to the represented text or throw a PlTypeException.

ExplicitNarrowingExplicitExplicitExplicit(PlTerm to Int32)
Yields a int if the PlTerm is a Prolog integer or float that can be converted without loss to a int. Throws a PlTypeException exception otherwise

ExplicitNarrowingExplicitExplicitExplicit(PlTerm to Double)
Yields the value as a C# double if PlTerm represents a Prolog integer or float. Throws a PlTypeException exception otherwise.

Finalize()()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetEnumerator()()()()
Returns an enumerator that iterates through the collection.

GetHashCode()()()()
Returns the hash code for this instance.
(Overrides ValueType.GetHashCode()()()().)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
GreaterThan(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

GreaterThanOrEqual(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Inequality(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

Inequality(PlTerm, Int32)
summary

Inequality(Int32, PlTerm)
summary

Inequality(PlTerm, String)
test

Inequality(String, PlTerm)
test

IsAtom
Return true if PlTerm is an atom.

IsAtomic
Return true if PlTerm is atomic (not variable or compound).

IsCompound
Return true if PlTerm is a compound term. Note that a list is a compound term ./2

IsFloat
Return true if PlTerm is a float.

IsGround
Return true if PlTerm is a ground term. See also ground/1. This function is cycle-safe.

IsInitialized
return false for a PlTerm variable wihich is only declareted and tru if it is also Initialized

IsInteger
Return true if PlTerm is an integer.

IsList
Return true if PlTerm is a compound term with functor ./2 or the atom [].

IsNumber
Return true if PlTerm is an integer or float.

IsString
Return true if PlTerm is a string.

IsVar
Return true if PlTerm is a variable

Item[([( Int32])])

If PlTerm is compound and index is between 0 and Arity (including), the nth PlTerm is returned.

If pos is 0 the functor of the term is returned (For a list '.').

See: PL_get_arg/3


LessThan(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

LessThanOrEqual(PlTerm, PlTerm)
Yields TRUE if the PlTerm is an atom or string representing the same text as the argument, FALSE if the conversion was successful, but the strings are not equal and an type_error exception if the conversion failed.

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Name

Get a holding the name of the functor if PlTerm is a compound term.


NextValue()()()()
return a PlTerm bound to the next element of the list PlTail and advance PlTail. Returns the element on success or a free PlTerm (Variable) if PlTail represents the empty list. If PlTail is neither a list nor the empty list, a PlTypeException (type_error) is thrown.

PlCharList(String)
Create a Prolog list of one-character atoms from a C#-string.

PlCodeList(String)
Create a Prolog list of ASCII codes from a 0-terminated C-string.

PlCompound(String, PlTermV)

Create a compound term with the given name from the given vector of arguments. See PlTermV for details.


PlCompound(String, PlTerm)

Create a compound term with the given name ant the arguments


PlCompound(String, PlTerm, PlTerm)

Create a compound term with the given name ant the arguments


PlCompound(String, PlTerm, PlTerm, PlTerm)

Create a compound term with the given name ant the arguments


PlString(String)
PlString(String, Int32)
PlTail(PlTerm)

PlTail is for analysing and constructing lists. It is called PlTail as enumeration-steps make the term-reference follow the `tail' of the list.

A PlTail is created by making a new term-reference pointing to the same object. As PlTail is used to enumerate or build a Prolog list, the initial list term-reference keeps pointing to the head of the list.


PlType
Get the PlType of a PlTerm.

PlVar()()()()
Creates a new initialised term (holding a Prolog variable).

ToList()()()()
Converts to a strongly typed ReadOnlyCollection of PlTerm objects that can be accessed by index

ToListString()()()()
Converts to a strongly typed Collection of strings that can be accessed by index

ToString()()()()

If PlTerm is a list the string is build by calling ToString() for each element in the list separated by ',' and put the brackets around '[' ']'.

(Overrides ValueType.ToString()()()().)
ToStringCanonical()()()()
Convert a PlTerm to a string by PL_get_chars/1 with the CVT_WRITE_CANONICAL flag. If it fails PL_get_chars/3 is called again with REP_MB flag.

Unify(PlTerm)
Unify a PlTerm with a PlTerm

Unify(String)
Unify a PlTerm with a PlTerm

Remarks
static method Description
PlVar()()()()
Creates a new initialised term (holding a Prolog variable).
PlTail(PlTerm)
PlTail is for analysing and constructing lists.
PlCompound(string)
Create compound terms. E.g. by parsing (as read/1) the given text.
PlString(String)
Create a SWI-Prolog string.
PlCodeList(String)
Create a Prolog list of ASCII codes from a 0-terminated C-string.
PlCharList(String)
Create a Prolog list of one-character atoms from a 0-terminated C-string.

Assembly: SwiPlCs (Module: SwiPlCs) Version: 1.1.60301.0 (1.1.60301.0)