Not sure if this what you want but how about:

def round(xs: Set[(Int, Int)]) = {
    // here you might check if items are exhausted and possibly don't go through recursion deeper

    val suitable = xs.filter {
        case (x, i) => 
            println("Element "+x+" on position "+i)
            x != 0

    // do something with suitable items

    round(xs.diff(suitable)) // next round with items that doesn't succeed in current round

val list = List(3,4,5)

Related Query

More Query from same tag