示例#1
0
        public void foldl0()
        {
            string        seed   = "hi mom";
            List <string> values = Helper <string> .mkList();

            FastFunc <string, FastFunc <string, string> > fn =
                FuncConvert.ToFastFunc((Converter <string, string, string>) delegate(string a, string b) { throw new Exception("should never be invoked"); });

            string result = Zumbro.foldl <string, string>(fn, seed, values);

            Assert.AreEqual(seed, result);
        }
示例#2
0
        public void foldl1()
        {
            int        seed   = 64;
            List <int> values = Helper <int> .mkList(4, 2, 4);

            FastFunc <int, FastFunc <int, int> > fn =
                FuncConvert.ToFastFunc((Converter <int, int, int>) delegate(int a, int b) { return(a / b); });

            int result = Zumbro.foldl <int, int>(fn, seed, values);

            Assert.AreEqual(2, result);
        }