On Thu, Feb 28, 2013 at 05:50:41AM -0800, l.a.derks wrote:
> What is the best way to calculate the total sum of these variables?
Spire [1] supports math operations on tuples (products), so you could
say something like:
import spire.implicits._
val pairs = List((9, 4), (1, 3), (44, 5), (-3, 12))
val sums = pairs.qsum // (51, 24)
We don't actually have direct support for case classes yet, although
the hope is that soon you'll be able to do something like this on case
classes directly, either via integration with shapeless, via macros, or
some other way.
-- Erik
[1]
https://github.com/non/spire