Is there a way to pass some extra parameter to the function that is provided to Scala’s List.foldRight?
Some example code:
def createActorPool[T](implicit actor: Manifest[T], poolSize: Int): List[Supervise] = {
(1 to poolSize).foldRight(List[Supervise]()) {
(idx, list) => { Supervise(actorOf[actor], Permanent) :: list }
}
}
The object I am interested in is actor, which is however not visible when being used to construct Supervise.
P.S.: I’m pretty new to Scala, so please accept my apologies if this is a FAQ (despite extensive googling without any applicable hits).
I don’t really get your problem.
The function passed to foldRight is free to reference and use anything else you have in scope.
Isn’t that enough ?