public static IArray <T> Flatten <T>(this IArray <IArray <T> > seqs) { IArray <long> tmp = seqs.Select(xs => xs.Count).PartialSums(); var r = new T[tmp.Last()]; tmp = tmp.DropSuffix(1); for (int i = 0; i < seqs.Count; ++i) { seqs[i].CopyTo(r, (int)tmp[i]); } return(new ArrayAdapter <T>(r)); }
public static IArray <int> AdjacentDifferences(this IArray <int> self) { return(self.Skip(1).Zip(self.DropSuffix(1), (a, b) => a - b)); }