here is what I am using for now (yes, I want to g...
# announcements
v
here is what I am using for now (yes, I want to generalise it somehow):
Copy code
val (As, Bs) = list.mapIndexed { i, it -> Pair(it, i) }.partition { condition(it) }
    
    val Cs = As. map {..}.filter{..}.sortBy{..}

    return (As + Cs).sortedBy {it.second}.map {it.first}