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 immutable version of sorted(Reverse)Take #484

Merged
merged 1 commit into from
Aug 18, 2015
Merged

add immutable version of sorted(Reverse)Take #484

merged 1 commit into from
Aug 18, 2015

Conversation

nevillelyh
Copy link
Collaborator

No description provided.

@ianoc
Copy link
Collaborator

ianoc commented Aug 18, 2015

Test(s)?

@@ -87,3 +87,9 @@ class TopKMonoid[T](k: Int)(implicit ord: Ordering[T]) extends Monoid[TopK[T]] {
TopK(size, reversed, max)
}
}

class TopKToListAggregator[A](max: Int)(implicit ord: Ordering[A]) extends MonoidAggregator[A, TopK[A], List[A]] {
override def monoid: Monoid[TopK[A]] = new TopKMonoid[A](max)(ord)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we make this a val? the def will allocate on each access.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@nevillelyh
Copy link
Collaborator Author

@ianoc I see that both TopKMonoid and PriorityQueueMonoid are covered but there's nothing for Aggregator._. Is this necessary?

@ianoc
Copy link
Collaborator

ianoc commented Aug 18, 2015

If none of the other aggregators are covered thats fine. I was just hoping it would be a 1 - 2 line addition. Oh well

@ianoc
Copy link
Collaborator

ianoc commented Aug 18, 2015

LGTM, thanks!

ianoc added a commit that referenced this pull request Aug 18, 2015
add immutable version of sorted(Reverse)Take
@ianoc ianoc merged commit 37c740d into twitter:develop Aug 18, 2015
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.

3 participants