コード例 #1
0
 public IFunc <MyNullable <T>, MyNullable <U> > FMap <U>(IFunc <T, U> func)
 {
     return(new Function <MyNullable <T>, MyNullable <U> >(t =>
     {
         if (t.HasValue)
         {
             return new MyNullable <U>(func.Evaluate(t.Value));
         }
         else
         {
             return new MyNullable <U>();
         }
     }));
 }
コード例 #2
0
        public IFunc <MyEnumerable <T>, MyEnumerable <U> > FMap <U>(IFunc <T, U> func)
        {
            return(new Function <MyEnumerable <T>, MyEnumerable <U> >(_t =>
            {
                List <U> u = new List <U>();

                foreach (T t in _t)
                {
                    u.Add(func.Evaluate(t));
                }

                return new MyEnumerable <U>(u);
            }));
        }