3 ms·
It's not as concise, but you could do List((1,2),(3,4)) map (plus _).tupled
by ArturSoler 12y ago
It's not as concise, but you could do
List((1,2),(3,4)) map (plus _).tupled
- virtualwhys 12y agoNicely done ;-) However, not so easy to grok without knowing how to lift methods to functions in Scala and then applying the swiss army method of functionN types, `tupled`, to the result. The F# equivalent one understands without needing to know special features of the language, it's pretty clear what's happening.
- frowaway001 12y ago> The F# equivalent one understands without needing to know special features of the language, it's pretty clear what's happening. The requirement to explicitly say that you want to pass a method around, not the value of the evaluated method was an explicit design decision in Scala, because very often it was not clear for developers what was happening (or more precise: they thought they knew, but something different happened).