I'm trying to process triplets in a list. Imperatively, I could do this:
for(i = 1; i < list.length-1; i++)
{
process( list[i-1], list[i], list[i+1] )
}
Is there a List function in Scala (or how would one write it) that can do something like this:
val data = [1,2,3,4,5,6,7,8,9,10]
val tuples = data.some_magic_func
tuples would be[(1,2,3), (2,3,4), (3,4,5), (4,5,6) ... ]
Thanks!