[all packages]
[package net.sf.pizzacompiler.lang]
[class hierarchy]
[index]
java.lang.Object | +----net.sf.pizzacompiler.lang.List<A>
public class List<A> implements java.io.Serializable
Sample list construction for a list of strings:
import pizza.lang.List;
import pizza.lang.List.*; // imports case constructors of the list class
...
List<String> list = Cons("element 1", Nil);
list = Cons("element 2", Cons("element 3", list));
for (List<String> now=list; now != Nil; now = now.tail()) {
System.out.println(now.head());
}
Results:
element 2 element 3 element 1

Cons(A, List<A>)
Nil

at(int)
bind((A) -> List<B>)
concat(List<A>)
concat(A)
concatenate(List<List<A>>)
cons(A, A, A)
cons(A, A)
cons(A)
cons(A, A, A, A, A, A)
cons(A, A, A, A, A, A, A, A, A, A)
cons(A, A, A, A, A, A, A, A, A)
cons(A, A, A, A, A, A, A, A)
cons(A, A, A, A, A, A, A)
cons(A, A, A, A, A)
cons(A, A, A, A)
cons()
contains(A)
copy(A[], int)
copy(A[])
diff(A)
diff(List<A>)
drop(int)
n elements.
elements()
elementsToString(String)
equals(Object)
filter((A) -> boolean)
foldl((B, A) -> B, B)
foldr((A, B) -> B, B)
forall((A) -> B)
fromArray(A[])
hashCode()
head()
init()
isEmpty()
last()
length()
map((A) -> B)
reverse()
split(int)
tail()
take(int)
n elements of this list.
toString()
zip(List<A>)

Nilpublic case Nil;
public case Cons(A head,
List<A> tail);

isEmptypublic boolean isEmpty();
public int length();
public A head();
public List<A> tail();
public List<A> take(int n);
n elements of this list.public List<A> drop(int n);
n elements.public Pair<List<A>, List<A>> split(int n);
public A at(int n);
public A last();
public List<A> init();
public List<A> reverse();
public List<A> concat(A y);
public List<A> concat(List<A> ys);
public static <A> List<A> concatenate(List<List<A>> xss);
public <B> void forall((A) -> B f);
void myPrint(String s)
{ System.out.println(s); }
...
list.forall(myPrint);
public <B> List<B> map((A) -> B f);
int myTwoTimes(int i)
{ return i*2; }
...
List twoTimesList = list.map(myTwoTimes);
public <B> List<B> bind((A) -> List<B> f);
ListmyTwoTimes(int i) { List myList = Nil; for (int a = 0; a < i; a++) myList = Cons(i, myList); return myList; } ... List twoTimesList = list.bind(myTwoTimes);
public List<A> filter((A) -> boolean p);
public <B> B foldl((B, A) -> B f,
B z);
String plus(String a, char b)
{
return a + b;
}
List list = List.cons('1', '2', '3', '4');
System.out.println( list.foldl(plus, "List!") );
Returns: List!1234
public <B> B foldr((A, B) -> B f,
B z);
static String plus(char b, String a)
{
return b + a;
}
List list = List.cons('1', '2', '3', '4');
System.out.println(list.foldr(plus, "List!"));
Returns: 1234List!public boolean contains(A y);
public List<A> diff(List<A> ys);
public List<A> diff(A y);
public int hashCode();
public boolean equals(Object other);
public String toString();
public String elementsToString(String sep);
public Enumeration<A> elements();
public List<Pair<A, A>> zip(List<A> ys);
public static <A> List<A> fromArray(A[] elems);
public A[] copy(A[] elems);
public A[] copy(A[] elems,
int offset);
public static <A> List<A> cons();
public static <A> List<A> cons(A x1);
public static <A> List<A> cons(A x1,
A x2);
public static <A> List<A> cons(A x1,
A x2,
A x3);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5,
A x6);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5,
A x6,
A x7);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5,
A x6,
A x7,
A x8);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5,
A x6,
A x7,
A x8,
A x9);
public static <A> List<A> cons(A x1,
A x2,
A x3,
A x4,
A x5,
A x6,
A x7,
A x8,
A x9,
A x10);
[all packages]
[package net.sf.pizzacompiler.lang]
[class hierarchy]
[index]