Exemplo n.º 1
0
        public void SecondFunctorLawHoldsForMapLeaf(IRoseTree <int, string> t)
        {
            bool f(int x) => x % 2 == 0;
            int g(string s) => s.Length;

            Assert.Equal(
                t.MapLeaf(x => f(g(x))),
                t.MapLeaf(g).MapLeaf(f));
        }
Exemplo n.º 2
0
        public void ConsistencyLawHolds(IRoseTree <int, string> t)
        {
            DateTime f(int i) => new DateTime(i);
            bool g(string s) => string.IsNullOrWhiteSpace(s);

            Assert.Equal(t.BiMap(f, g), t.MapLeaf(g).MapNode(f));
            Assert.Equal(
                t.MapNode(f).MapLeaf(g),
                t.MapLeaf(g).MapNode(f));
        }
Exemplo n.º 3
0
 public static IRoseTree <N, L1> Select <N, L, L1>(
     this IRoseTree <N, L> source,
     Func <L, L1> fn)
 => source.MapLeaf(fn);
Exemplo n.º 4
0
 public void MapLeafObeysFirstFunctorLaw(IRoseTree <int, string> t)
 {
     Assert.Equal(t, t.MapLeaf(Id));
 }