Пример #1
0
            public static IEnumerable Map(IApply func, IEnumerable[] seqs)
            {
                switch (seqs.Length)
                {
                case 1:
                {
                    var args = new object[1];
                    foreach (var item in ToIter(seqs[0]))
                    {
                        args[0] = item;
                        yield return(func.Apply(args));
                    }
                    break;
                }

                case 2:
                {
                    var args  = new object[2];
                    var iter1 = ToIter(seqs[0]).GetEnumerator();
                    var iter2 = ToIter(seqs[1]).GetEnumerator();
                    while (iter1.MoveNext() && iter2.MoveNext())
                    {
                        args[0] = iter1.Current;
                        args[1] = iter2.Current;
                        yield return(func.Apply(args));
                    }
                    break;
                }

                case 3:
                {
                    var args  = new object[3];
                    var iter1 = ToIter(seqs[0]).GetEnumerator();
                    var iter2 = ToIter(seqs[1]).GetEnumerator();
                    var iter3 = ToIter(seqs[2]).GetEnumerator();
                    while (iter1.MoveNext() && iter2.MoveNext() && iter3.MoveNext())
                    {
                        args[0] = iter1.Current;
                        args[1] = iter2.Current;
                        args[2] = iter3.Current;
                        yield return(func.Apply(args));
                    }
                    break;
                }

                default:
                {
                    var iter = new UnisonEnumerator(seqs);
                    foreach (Vector item in iter)
                    {
                        yield return(func.Apply(AsArray(item)));
                    }
                    break;
                }
                }
            }
Пример #2
0
        private void sureButton_Click(object sender, EventArgs e)
        {
            TabPage page = this.tabControl.TabPages[this.tabControl.SelectedIndex];
            IApply  c    = (IApply)page.Controls[0];

            c.Apply();
        }
Пример #3
0
 public static object Funcall(IApply func, params object[] args)
 {
     if (func == null)
     {
         return(Identity(args));
     }
     else
     {
         return(func.Apply(args));
     }
 }
Пример #4
0
        public async Task Save(T input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            var item = await FindById(input.Id);

            if (item == null)
            {
                item = new T();
                await Add(item);
            }

            _mapper.Apply(item, input);
            await _dbContext.SaveChangesAsync();
        }
Пример #5
0
 public static IEnumerable Map(IApply func, IEnumerable[] seqs)
 {
     switch (seqs.Length)
     {
         case 1:
             {
                 var args = new object[1];
                 foreach (var item in ToIter(seqs[0]))
                 {
                     args[0] = item;
                     yield return func.Apply(args);
                 }
                 break;
             }
         case 2:
             {
                 var args = new object[2];
                 var iter1 = ToIter(seqs[0]).GetEnumerator();
                 var iter2 = ToIter(seqs[1]).GetEnumerator();
                 while (iter1.MoveNext() && iter2.MoveNext())
                 {
                     args[0] = iter1.Current;
                     args[1] = iter2.Current;
                     yield return func.Apply(args);
                 }
                 break;
             }
         case 3:
             {
                 var args = new object[3];
                 var iter1 = ToIter(seqs[0]).GetEnumerator();
                 var iter2 = ToIter(seqs[1]).GetEnumerator();
                 var iter3 = ToIter(seqs[2]).GetEnumerator();
                 while (iter1.MoveNext() && iter2.MoveNext() && iter3.MoveNext())
                 {
                     args[0] = iter1.Current;
                     args[1] = iter2.Current;
                     args[2] = iter3.Current;
                     yield return func.Apply(args);
                 }
                 break;
             }
         default:
             {
                 var iter = new UnisonEnumerator(seqs);
                 foreach (Vector item in iter)
                 {
                     yield return func.Apply(AsArray(item));
                 }
                 break;
             }
     }
 }
Пример #6
0
 public static int FuncallInt(IApply func, params object[] args)
 {
     return((int)func.Apply(args));
 }
Пример #7
0
 public static bool FuncallBool(IApply func, params object[] args)
 {
     return(ToBool(func.Apply(args)));
 }
Пример #8
0
 public static object ApplyStar(IApply func, params object[] args)
 {
     return(func.Apply(MakeArrayStar(args)));
 }
Пример #9
0
 public static object Apply(IApply func, object[] args)
 {
     return(func.Apply(args));
 }
Пример #10
0
 public static int FuncallInt(IApply func, params object[] args)
 {
     return (int)func.Apply(args);
 }
Пример #11
0
 public static bool FuncallBool(IApply func, params object[] args)
 {
     return ToBool(func.Apply(args));
 }
Пример #12
0
 public static object Funcall(IApply func, params object[] args)
 {
     if (func == null)
     {
         return Identity(args);
     }
     else
     {
         return func.Apply(args);
     }
 }
Пример #13
0
 public static object ApplyStar(IApply func, params object[] args)
 {
     return func.Apply(MakeArrayStar(args));
 }
Пример #14
0
 public static object Apply(IApply func, object[] args)
 {
     return func.Apply(args);
 }
Пример #15
0
            public string Evaluate(Match match)
            {
                string result = MakeString(transform.Apply(RegexBind(match)));

                return(result);
            }