public class List extends Compound
List el =
new List(
new Atom( "a" ),
new List(
new Atom( "b" ),
new List(
new Atom( "c" ),
List.NIL ) ) );
This constructor (somewhat longwindedly) creates a List that
corresponds to the Prolog list [a,b,c], or more accurately,
[a|[b|[c|[]]]].Note the following:
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.
| Modifier and Type | Class and Description |
|---|---|
static class |
List.Nil
The Nil class is used to terminate a List.
|
| Constructor and Description |
|---|
List(Term head,
Term tail)
This constructor is used to create a List.
|
| Modifier and Type | Method and Description |
|---|---|
String |
debugString() |
Enumeration |
elements()
This method return an enumeration of a nil-terminated List.
|
Term |
head() |
int |
length()
This method returns the length of a List.
|
static Atom |
list() |
static List |
list(Term t0) |
static List |
list(Term t0,
Term t1) |
static List |
list(Term t0,
Term t1,
Term t2) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7,
Term t8) |
static List |
list(Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7,
Term t8,
Term t9) |
protected boolean |
nil_terminated() |
Term |
tail() |
boolean |
tailIsNil() |
String |
toString()
Converts a Compound to its String form, atom( arg_1, ..., arg_n )
|
Term[] |
toTermArray()
This method returns an array containg the Terms in
the List.
|
args, atom, computeSubstitution, equals, from_term_t, ith, putcomputeSubstitutions, debugString, from_term_t, terms_equals, terms_to_term_ts, toStringpublic static final Atom NIL
public List(Term head, Term tail)
head - the List's headtail - the List's tailpublic final Term head()
public final Term tail()
public final boolean tailIsNil()
public String toString()
Compoundpublic String debugString()
debugString in class Compoundpublic static Atom list()
public static List list(Term t0, Term t1, Term t2)
public static List list(Term t0, Term t1, Term t2, Term t3)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4, Term t5)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7, Term t8)
public static List list(Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7, Term t8, Term t9)
public int length()
public Term[] toTermArray()
protected boolean nil_terminated()
public Enumeration elements()
Copyright © 2015. All rights reserved.