예제 #1
0
        public void FoldR1()
        {
            var list   = FList.New(1, 2, 4, 8, 16);
            int actual = FList.FoldR((agg, input) => agg + input, 0, list);

            Assert.AreEqual(31, actual);
        }
예제 #2
0
        public void FoldR1String()
        {
            var list   = "abcde";
            int actual = FList.FoldR((agg, input) => agg + Convert.ToInt32(input), 0, list);

            Assert.AreEqual(495, actual);
        }
예제 #3
0
        public void FoldR4()
        {
            var list   = FList.New(1, 2, 4, 8, 16);
            int actual = FList.FoldR((agg, input) => agg / input, 1, list);

            Assert.AreEqual(4, actual);
        }
예제 #4
0
        public void FoldR5()
        {
            var    list   = FList.New <int>(1, 2, 4, 8, 16);
            string actual = FList.FoldR <int, string>((input, agg) => agg + input.ToString(), "", list);

            Assert.AreEqual("124816", actual);
        }