internal bool Find(T x) { FList <T> curr = this; while (curr != Empty) { if (curr.elem.Equals(x)) { return(true); } curr = curr.next; } return(false); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("< "); if (this != Empty) { sb.Append(this.elem); FList <T> curr = this.next; while (curr != Empty) { sb.Append(", " + curr.elem.ToString()); curr = curr.next; } sb.Append(" >"); } return(sb.ToString()); }
internal FList <T> Cons(T elem, FList <T> next) { return(new FList <T>(elem, next)); }
internal FList(T elem, FList <T> next) { this.elem = elem; this.next = next; }