Can you make an anonymous val?
I am going to do something like this:
case class NumIterations[A](num: Int)
case class Seed[A](seed: A)
case class Manipulate[A](f: A => A)
. . .
def funcWithGobsOfImplicitArgs[A](
implicit numIterations: NumIterations[A],
seed: Seed[A],
manipulate: Manipulate[A],
. . .
): A = . . .
def apply(): String = {
implicit val NumIterations[String](10) // This is where I want anonymous vals
implicit val Seed("xyz")
. . .
funcWithGobsOfImplicitArgs
}
It’s good that all implicit function arguments will probably be overboard, but I really have a real application where it’s convenient to insert some functional parameters into the scope and then reuse and redefine them. This makes the experiment with the function very convenient. I can play with one parameter at a time explicitly, and let all the others be provided implicitly.
val, , val . vals, _, , Scala val, . vals _, Scala .