`scheduleRec` for recursive scheduling (Scala)