```
let a = [0, 1, 2, 3, 4, 5, [...]]; // More generally, for any &[T]
let res = apply(&a);
assert_eq!([[0, 1], [1,2], [2,3], [3,4], [4,5]], res);
```

Is there an iterator that does exactly what `apply`

performs?

```
let a = [0, 1, 2, 3, 4, 5, [...]]; // More generally, for any &[T]
let res = apply(&a);
assert_eq!([[0, 1], [1,2], [2,3], [3,4], [4,5]], res);
```

Is there an iterator that does exactly what `apply`

performs?

(needing this for a recursive function)

```
fn apply<T>(s: &[T]) -> Vec<&[T]> {
s.windows(2).collect()
}
```

2 Likes

Gonna give Krishna the solution, but asymmetrikon my heart

Thanks guys!