mardi 31 mars 2015

Pattern for hiding recursive function in Scala

Given this recursive function :



def visitAll(s: String): Unit = {
val files = getFiles
for (a <- files) {
visitAll(s)
doSomeWork()
}
}


This will act as a driver for work. Is there a pattern or Scala idiom that will allow to hide recursive structure from developer so all all developer needs to worry about is implementing method doSomeWork() ?


Aucun commentaire:

Enregistrer un commentaire