Example #1
0
        static Answer2 TakAnswer2a(int x, int y, int z)
        {
            if (!(y < x))
            {
                return(new Answer2(null, z));
            }
            Answer2 a1 = TakAnswer2b(x, y, z);

            while (a1.Next != null)
            {
                a1 = a1.Next();
            }
            ;
            Answer2 a2 = TakAnswer2b(y, z, x);

            while (a2.Next != null)
            {
                a2 = a2.Next();
            }
            ;
            Answer2 a3 = TakAnswer2b(z, x, y);

            while (a3.Next != null)
            {
                a3 = a3.Next();
            }
            ;
            return(new Answer2(
                       new Step2(delegate() { return TakAnswer2c((int)a1.FinalAnswer, (int)a2.FinalAnswer, (int)a3.FinalAnswer); }),
                       null));
        }
Example #2
0
        static void Main(string [] args)
        {
            Identify(Console.Out, "# ");
            Console.WriteLine("set terminal windows");
            Console.WriteLine("set logscale x");
            Console.WriteLine("set grid");
            Console.Write("plot \"-\" using 4:3 with lines");
            for (int i = 0; i < 3; i++)
            {
                Console.Write(", \"-\" using 4:3 with lines");
            }
            Console.WriteLine("");

            int nruns = 21;

            //DumpHistogram ("c:\\jrm-code-project\\TakTest\\takval2.txt", runThunk (1000, 10, delegate () {
            //    TakVal2 (18, 12, 6);
            //}), .000063609);
            DumpHistogram(Console.Out, runThunk(nruns, 10, delegate() { Tak(18, 12, 6); }), .000063609);
            Console.WriteLine("e");
            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { Tak1a (0, 18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (1000, 10, delegate () { Tak1b (0, 18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (1000, 10, delegate () { Tak2 (0, 1, 18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (1000, 10, delegate () { Tak3 (0, 1, 2, 18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            DumpHistogram(Console.Out, runThunk(nruns, 10, delegate() { int answer; TakOut(out answer, 18, 12, 6); }), .000063609);
            Console.WriteLine("e");
            DumpHistogram(Console.Out, runThunk(nruns, 10, delegate()
            {
                int answer;
                TakOut3d again;
                for (bool a = TakOut3a(out again, out answer, 18, 12, 6);
                     a;
                     a = again(out again, out answer))
                {
                }
                ;
            }), .000063609);
            Console.WriteLine("e");

            //DumpHistogram (Console.Out, runThunk (1000, 10, delegate () { int answer = 0; TakRef (ref answer, 18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { TakBox (18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { TakValb (18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { TakGlob (18, 12, 6); }), .000063609);
            //Console.WriteLine ("e");
            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { Answer2 a = TakAnswer2 (18,12,6); while (a.Next != null) {a = a.Next();}; }), .000063609);
            //Console.WriteLine ("e");
            DumpHistogram(Console.Out, runThunk(nruns, 10, delegate() { Answer2 a = TakAnswer2a(18, 12, 6); while (a.Next != null)
                                                                        {
                                                                            a = a.Next();
                                                                        }
                                                                        ; }), .000063609);
            Console.WriteLine("e");
            DumpHistogram(Console.Out, runThunk(nruns, 10, delegate() { Answer3 a = TakAnswer3(18, 12, 6); while (a.Next != null)
                                                                        {
                                                                            a = a.Next();
                                                                        }
                                                                        ; }), .000063609);
            Console.WriteLine("e");
            TakTrampInit();
            DumpHistogram(Console.Out, runThunk(nruns, 1, delegate() { TakInterpNew(); }), .000063609);
            Console.WriteLine("e");


            //DumpHistogram (Console.Out, runThunk (nruns, 10, delegate () { TakTramp (); }), .000063609);
            //Console.WriteLine ("e");

            //DumpHistogram (Console.Out, runThunk (1000, 10, delegate () { Tak4 (0, 1, 2, 3, 18, 12, 6); }), .000063609);

            Console.WriteLine();
            Console.WriteLine("# {0} exits", appName);
        }