score:0

Not sure if this what you want but how about:

@annotation.tailrec
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)
round(list.zipWithIndex.toSet)

Related Query

More Query from same tag