public static double[] ToDoubleArray(Obj obj) { if (obj.IsSeq()) { double[] array = obj.GetDoubleArray(); return(Array.Take(array, array.Length)); } Obj[] elts = obj.GetObjArray(); int len = elts.Length; double[] doubles = new double[len]; for (int i = 0; i < len; i++) { doubles[i] = elts[i].GetDouble(); } return(doubles); }
//////////////////////////////////////////////////////////////////////////// public static bool[] ToBoolArray(Obj obj) { if (obj.IsSeq()) { bool[] array = obj.GetBoolArray(); return(Array.Take(array, array.Length)); } Obj[] elts = obj.GetObjArray(); int len = elts.Length; bool[] bools = new bool[len]; for (int i = 0; i < len; i++) { bools[i] = elts[i].GetBool(); } return(bools); }
public static long[] ToLongArray(Obj obj) { if (obj.IsSeq()) { long[] array = obj.GetLongArray(); return(Array.Take(array, array.Length)); } Obj[] elts = obj.GetObjArray(); int len = elts.Length; long[] longs = new long[len]; for (int i = 0; i < len; i++) { longs[i] = elts[i].GetLong(); } return(longs); }