I don't really know how to describe what I'm doing, but this example should help:

```
val vals = Array( (0, true), 
                  (1, true), 
                  (2,true), 
                  (3,true), 
                  (4,false), 
                  (5, true), 
                  (6, true), 
                  (7, false), 
                  (8, true), 
                  (9,true))

```

I'm looking to identify the first and last elements in each of the 'true' regions, though partitioning the array when the value changes could work as well. I could do this imperatively, but what's the best way to do this in scala?