Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // Creates list containing 1, 2, 3, 4, 5
            var list = new FunctionalList <int>(1, new FunctionalList <int>(2,
                                                                            new FunctionalList <int>(3, new FunctionalList <int>(4,
                                                                                                                                 new FunctionalList <int>(5, new FunctionalList <int>())))));

            int sum = SumList(list); // Calculates sum and

            Console.WriteLine(sum);  // prints '15' as the result
        }
Exemplo n.º 2
0
 static int SumList(FunctionalList <int> numbers)
 {
     return(0);
 }
Exemplo n.º 3
0
 // Creates a new list containe value and a reference to tail
 public FunctionalList(T head, FunctionalList <T> tail)
 {
     IsEmpty = false; Head = head; Tail = tail;
 }