I have a case class that accepts a list of functions:
case class A(q:Double, r:Double, s:Double, l:List[(Double)=>Double])
I have over 20 functions. Some of these functions have their own settings, and some of them also use values q, rand sfrom the class of case. Two examples:
def f1(w:Double) = (d:Double) => math.sin(d) * w
def f2(w:Double, q:Double) = (d:Double) => d * q * w
The problem is that then I need to reference q, rand stwice when instantiating the case class:
A(0.5, 1.0, 2.0, List(f1(3.0), f2(4.0, 0.5)))
I would like to be able to instantiate the class as follows:
A(0.5, 1.0, 2.0, List(f1(3.0), f2(4.0)))
What is the best technique for this? Can I define my functions in an attribute that extends the case class?
EDIT: A real-world application consists of 7 members, not 3. Only a small number of functions need access to members. Most functions do not care about them.