Simplified (and slow) implementation: T[] splitLength(T)(T arr, size_t count) if (isArray!T) { T[] result; while (arr.length) { result ~= arr.take(count); arr.popFrontN(count); } return result; }