Class ListFactory

java.lang.Object
org.projog.core.term.ListFactory

public final class ListFactory extends Object
Static factory methods for creating new instances of List.
See Also:
  • Field Details

    • LIST_PREDICATE_NAME

      public static final String LIST_PREDICATE_NAME
      A "." is the functor name for all lists in Prolog.
      See Also:
  • Method Details

    • createList

      public static List createList(Term head, Term tail)
      Returns a new List with specified head and tail.
      Parameters:
      head - the first argument in the list
      tail - the second argument in the list
      Returns:
      a new List with specified head and tail
    • createList

      public static Term createList(Collection<? extends Term> terms)
      Returns a new List with the specified terms and a empty list as the final tail element.
      Parameters:
      terms - contents of the list
      Returns:
      a new List with the specified terms and a empty list as the final tail element
    • createList

      public static Term createList(Term[] terms)
      Returns a new List with the specified terms and a empty list as the final tail element.

      By having a List with a List as its tail it is possible to represent an ordered sequence of the specified terms.

      Parameters:
      terms - contents of the list
      Returns:
      a new List with the specified terms and a empty list as the final tail element
    • createList

      public static Term createList(Term[] terms, Term tail)
      Returns a new List with the specified terms and the second parameter as the tail element.

      By having a List with a List as its tail it is possible to represent an ordered sequence of the specified terms.

      Parameters:
      terms - contents of the list
      Returns:
      a new List with the specified terms and the second parameter as the tail element
    • createListOfLength

      public static Term createListOfLength(int length)
      Returns a new list of the specified length where is each element is a variable.