Passing extra parameters to foldRight

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).

Answers


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 ?


Need Your Help

Unable to get hiddenfield value via jquery

jquery asp.net

I'm trying to set the value of a hiddenfield via c# code, then get the value of that hiddenfield from jquery. I'm able to set it correctly in c#, however when I try to get it in jquery, the value's

setObject() Method and aliasing

java aliasing

I have a LINE class that has two attributes of type POINT (which is an object).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.