Lines Matching defs:List
24 class List<A> {
33 public List<A> tail;
37 public List(A head, List<A> tail) {
44 public List() {
50 public static <A> List<A> make(A x1) {
51 return new List<A>(x1, new List<A>());
56 public static <A> List<A> make(A x1, A x2) {
57 return new List<A>(x1, new List<A>(x2, new List<A>()));
62 public static <A> List<A> make(A x1, A x2, A x3) {
63 return new List<A>(x1, new List<A>(x2, new List<A>(x3, new List<A>())));
68 public static <A> List<A> make(A[] vec) {
69 List<A> xs = new List<A>();
71 xs = new List<A>(vec[i], xs);
79 public static <A> List<A> make(int len, A init) {
80 List<A> l = new List<A>();
81 for (int i = 0; i < len; i++) l = new List<A>(init, l);
100 List<A> l = this;
112 public List<A> prepend(A x) {
113 return new List<A>(x, this);
119 public List<A> prependList(List<A> xs) {
127 public List<A> reverse() {
128 List<A> rev = new List<A>();
129 for (List<A> l = this; l.nonEmpty(); l = l.tail)
130 rev = new List<A>(l.head, rev);
137 public List<A> append(A x) {
144 public List<A> appendList(List<A> x) {
153 List<A> l = this;
170 for (List<A> l = tail; l.nonEmpty(); l = l.tail) {
187 List<A> l = this;
199 return other instanceof List && equals(this, (List)other);
204 public static boolean equals(List xs, List ys) {
220 List<A> l = this;