static void TestInterfaceExercise3() { ListInt ls = new NodeInt(10, new NodeInt(4, new NodeInt(5, new NodeInt(3, new EmptyInt())))); ListInt lsFiltered = ls.Filter((x) => x % 2 == 0); lsFiltered.Iter((x) => Console.WriteLine(x)); // Console.WriteLine (ls.Length); }
public void Iter(Action <int> f) { f(head); tail.Iter(f); }