Skip to content

Instantly share code, notes, and snippets.

@davidandrzej
Last active August 29, 2015 14:04
Show Gist options
  • Save davidandrzej/ac4abe76c1a5058b05cc to your computer and use it in GitHub Desktop.
Save davidandrzej/ac4abe76c1a5058b05cc to your computer and use it in GitHub Desktop.
scala> implicit val em = EvaluationMonoid
em: EvaluationMonoid.type = EvaluationMonoid$@34f5b235
scala> implicit val mm = mapMonoid[String,Evaluation]
mm: scalaz.Monoid[Map[String,Evaluation]] = scalaz.std.MapInstances$$anon$4@13105b09
scala> val dataset1 = Map("modelA" -> Evaluation(3,2),
| "modelB" -> Evaluation(4,1))
dataset1: scala.collection.immutable.Map[String,Evaluation] =
Map(modelA -> Evaluation(3,2), modelB -> Evaluation(4,1))
scala> val dataset2 = Map("modelA" -> Evaluation(5,4))
dataset2: scala.collection.immutable.Map[String,Evaluation] =
Map(modelA -> Evaluation(5,4))
scala> mm.append(dataset1,dataset2)
res3: Map[String,Evaluation] =
Map(modelA -> Evaluation(8,6), modelB -> Evaluation(4,1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment