Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Object IntOps {
- def IntOps(f: Int => Int)(values: List[Int]): Int = {
- def Ops(value : Int, values: List[Int]) : Int = {
- if(values.isEmpty) value
- else Ops (value + f(values.head), values.tail)
- }
- Ops(0, values);
- }
- IntOps(x=> x+x)(List(1, 2, 30))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement