Exemplo n.º 1
0
        public static FuncyList <T> Take <T>(this FuncyList <T> source, int count)
        {
            if (source.IsNil || count <= 0)
            {
                return(FuncyList <T> .Nil());
            }

            return(FuncyList <T> .Construct(((IEnumerable <T>)source).Take <T>(count).ToArray()));
        }
Exemplo n.º 2
0
 public FuncyList <TReturn> Apply <TReturn>(FuncyList <Func <T, TReturn> > f)
 {
     if (f.IsCons)
     {
         return(FuncyList <TReturn> .Construct(f.ToList().SelectMany(fCons => this.FMap(fCons)).ToArray()));
     }
     else
     {
         return(FuncyList <TReturn> .Nil());
     }
 }
Exemplo n.º 3
0
        public static FuncyList <T> Construct(params T[] args)
        {
            FuncyList <T> result = FuncyList <T> .Nil();

            for (int i = args.Length - 1; i >= 0; i--)
            {
                result = FuncyList <T> .Cons(args[i], result);
            }

            return(result);
        }
Exemplo n.º 4
0
 public override FuncyList <TReturn> ComputeWith <TReturn>(Func <T, FuncyList <TReturn> > f)
 {
     return(FuncyList <TReturn> .Nil());
 }
Exemplo n.º 5
0
 public override FuncyList <TReturn> FMap <TReturn>(Func <T, TReturn> f)
 {
     return(FuncyList <TReturn> .Nil());
 }