Beispiel #1
0
 public static Obj CreateSeq(double[] vals, int len)
 {
     if (len != 0)
     {
         return(FloatArrayObjs.Create(vals, len));
     }
     else
     {
         return(EmptySeqObj.singleton);
     }
 }
Beispiel #2
0
 public static Obj CreateSeq(double[] vals)
 {
     if (vals.Length != 0)
     {
         return(FloatArrayObjs.Create(vals));
     }
     else
     {
         return(EmptySeqObj.singleton);
     }
 }
Beispiel #3
0
        public static Obj CreateSeq(Obj[] objs)
        {
            int len = objs.Length;

            if (len == 0)
            {
                return(EmptySeqObj.singleton);
            }

            if (objs[0].IsInt())
            {
                for (int i = 1; i < len; i++)
                {
                    if (!objs[i].IsInt())
                    {
                        return(ArrayObjs.Create(objs));
                    }
                }

                long[] longs = new long[len];
                for (int i = 0; i < len; i++)
                {
                    longs[i] = objs[i].GetLong();
                }
                return(IntArrayObjs.Create(longs));
            }

            if (objs[0].IsFloat())
            {
                for (int i = 1; i < len; i++)
                {
                    if (!objs[i].IsFloat())
                    {
                        return(ArrayObjs.Create(objs));
                    }
                }

                double[] doubles = new double[len];
                for (int i = 0; i < len; i++)
                {
                    doubles[i] = objs[i].GetDouble();
                }
                return(FloatArrayObjs.Create(doubles));
            }

            return(ArrayObjs.Create(objs));
        }