Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sumOption support for Tuples #242

Merged
merged 3 commits into from Dec 3, 2013
Merged

Add sumOption support for Tuples #242

merged 3 commits into from Dec 3, 2013

Conversation

johnynek
Copy link
Collaborator

This makes sumOption on tuples only call through to sumOption on the underlying Semigroups.

@@ -6,6 +6,14 @@ package com.twitter.algebird
*/
class Tuple2Semigroup[A, B](implicit asemigroup : Semigroup[A], bsemigroup : Semigroup[B]) extends Semigroup[(A, B)] {
override def plus(l : (A, B), r : (A, B)) = (asemigroup.plus(l._1, r._1), bsemigroup.plus(l._2, r._2))
override def sumOption(to : TraversableOnce[(A, B)]) = {
val buf = new ArrayBufferedOperation[(A, B), (A, B)](1000) with BufferedReduce[(A, B)] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that these are autogenerated but it would be good to make put this magic constant at the top.

azymnis added a commit that referenced this pull request Dec 3, 2013
Add sumOption support for Tuples
@azymnis azymnis merged commit d0fb0df into develop Dec 3, 2013
@ianoc ianoc deleted the tuple-sumOption branch December 3, 2013 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants