예제 #1
0
        public static void Test()
        {
            OptionalM <int> optionalM = new OptionalM <int>();

            ApplyFunc(ele => {
                Printing.Println(MyToString.ToStr(ele) + "\t = " + optionalM.Appends((int?[])ele));
            },
                      new int?[] { 1, null, null },
                      new int?[] { null, 2, null },
                      new int?[] { null, null, 3 },
                      new int?[] { 1, 2, null },
                      new int?[] { 1, null, 3 },
                      new int?[] { null, 2, 3 },
                      new int?[] { 1, 2, 3 }
                      ).ln();

            Monoid <Action> todo = new Todo();

            todo.Appends(
                () =>  Console.WriteLine("logic1"),
                todo.When(true, () => Console.WriteLine("logic2 When true")),
                todo.Cond(false,
                          () => Console.WriteLine("logic3 Cond true"),
                          () => Console.WriteLine("logic4 Cond false"))
                )();
        }
예제 #2
0
 static void Main(string[] args)
 {
     LinkedListLibrary.List list = new LinkedListLibrary.List();
     Console.WriteLine("A list");
     list.InsertAtBack(2.4);
     list.InsertAtBack(4.5);
     list.InsertAtBack(2.7);
     list.InsertAtBack(1.9);
     list.InsertAtBack(7.2);
     list.Display();
     Console.WriteLine("Search for 7.3... It exists?");
     Console.WriteLine(list.Search(7.3) > 0?"Yes, it does!": "No, it does not!");
     Console.WriteLine("Search for 7.2... It exists?");
     Console.WriteLine(list.Search(7.2) > 0 ? "Yes, it does!" : "No, it does not!");
     Console.WriteLine("There are " + list.Count() + " in the List!");
     Console.WriteLine("The SUM of all elements in the list is: " + MyToString.ToString(list.Sum()));
 }