adjacentNTuples<T> function

List<List<T>> adjacentNTuples<T>(
  1. List<T> objects,
  2. int n
)

Implementation

List<List<T>> adjacentNTuples<T>(List<T> objects, int n) {
  return [
    for (var i in range(end: objects.length))
      [for (var offset in range(end: n)) objects[(i + offset) % objects.length]]
  ];
}