Esempio n. 1
0
        private static void FunctionCompositionRoutine()
        {
            Func <int, int, IEnumerable <int> > range = Enumerable.Range;

            var handler = range.ForwardCompose(Select <int, int> .Apply(x => x * x * x))
                          .ForwardCompose(Select <int, int> .Apply(x => x / 2))
                          .ForwardCompose(Where <int> .Apply(x => x % 2 == 1))
                          .ForwardCompose(ForEach <int> .Apply(Console.WriteLine));

            handler(1, 10);
        }
Esempio n. 2
0
        private static void BlockStyleRoutine()
        {
            var request = new RangeRequest {
                Start = 1, Count = 10
            };

            var handler = new RangeEnumerator().Forward(Select <int, int> .Apply(x => x * x * x))
                          .Forward(Select <int, int> .Apply(x => x / 2))
                          .Forward(Where <int> .Apply(x => x % 2 == 1))
                          .Forward(ForEach <int> .Apply(Console.WriteLine));

            handler.Handle(request);
        }