Skip to content

Commit

Permalink
Bag.flatten: Mention alternative implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaisorblade committed May 27, 2015
1 parent 25d1007 commit cfe4408
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/test/scala/ilc/examples/handwritten/NestedLoop1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ object BagUtils {
implicit def config[T] = Bag.configuration.compact[T]
implicit class FlattenOps[T](b: Bag[Bag[T]]) {
def flattenB: Bag[T] = {
//Alternative implementation, but quadratic because of
//https://github.com/nicolasstucki/multisets/issues/7
//b.fold[Bag[T]](Bag.empty)(_ union _)
val builder = Bag.newBuilder[T]
for (baglet <- b)
builder ++= baglet
Expand Down

0 comments on commit cfe4408

Please sign in to comment.