Esempio n. 1
0
 public bool Equals(MList <T> first, MList <T> second)
 {
     return(first.Match(
                empty: () => second.Match(
                    empty: () => true,
                    list:  (x, xs) => false),
                list:  (x, xs) => second.Match(
                    empty: () => false,
                    list:  (y, ys) => x.Equals(y) && Equals(xs, ys))));
 }
Esempio n. 2
0
 public int GetHashCode(MList <T> mlist)
 {
     return(mlist.Match(
                empty: () => typeof(T).GetHashCode(),
                list:  (x, xs) => x.GetHashCode() + 31 * GetHashCode(xs)));
 }