What is the best way to mix a function input parameter with the output.
Here is my current code :
def zip[A,B](f: A => B) : A => (A, B) = (a: A) => (a, f(a))
def zip[A,B](pf: PartialFunction[A,B]) : PartialFunction[A, (A, B)] = {
case a if pf.isDefinedAt(a) => (a, pf(a))
}
Is there a better way ? Is there a better naming for that ?