|
|
|
|
|
by valenterry
2053 days ago
|
|
Assuming that your object is a list of tuples, then you can do: val myFun = (a: String, b: Int) => b % 2 == 0
List("a" -> 1, "b" -> 2, "c" -> 3).map(myFun.tupled).forall(identity) // false
List("a" -> 2, "b" -> 4, "c" -> 6).map(myFun.tupled).forall(identity) // true
But I think that's not what you mean... are you maybe looking for the "thrush" / |> operator? Or do you have some example from another language that does a better job and show how it looks there? |
|