I have a code snippet like this:
def until(terminationCond: List[A]=>Boolean, combiner: List[A]=>List[A] )(obj: List[A]): A = { var tempObj = obj while(!terminationCond(tempObj)) { tempObj = combiner(obj) } tempObj.head } I am looking out a way to write this code from functional programming style, avoiding any mutable types.
combiner(obj)is, by definition, not FP because it is a function that repeatedly takes the same argument but returns different results.