More vague understanding of ???
Is there a way to replace the functions pair => pair._1
and pair => pair._2
with ???
in the following code and have the code still compile?
def makeAdjDirected[V](edges: Seq[(V,V)]):Map[V,Set[V]] = {
edges.groupBy(pair => pair._1)
.map{case (src, edges) =>
val destinations = edges.map(pair => pair._2)
src -> destinations.toSet
}
}
When I do a straightforward replacement I get a compilation error:
missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: ((?, Seq[(V, V)])) => ?
.map{case (src, edges) =>
in
def makeAdjDirected[V](edges: Seq[(V,V)]):Map[V,Set[V]] = {
edges.groupBy(???)
.map{case (src, edges) =>
val destinations = edges.map(???)
src -> destinations.toSet
}
}