Perhaps you want - if the validation functions take no arguments
def firstProblem(fs: (() => Option[Problem])*) = { fs.iterator.map(f => f()).find(_.isDefined).flatten }
You will receive an existing Option[Problem] , if any, or None if all of them are successful. If you need to pass arguments to functions, you need to explain what these arguments are. For example, you could
def firstProblem[A](a: A)(fs: (A => Option[Problem])*) = /* TODO */
if you can pass the same argument to all of them. You would use it as follows:
firstProblem(myData)( validatorA, validatorB, validatorC, validatorD )
source share