Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def union(that: TweetSet): TweetSet = {
(left union (right union that)) incl elem
// If we have two trees x={{{.a.}b.}c{.d{.e.}}} and y={{{.f.}g.}h{.i{.j.}}} the number of calls to union varies dramatically according to how we order things:
//
// (left union (right union that)) incl elem // calls=5
// (right union (left union that)) incl elem // calls=5
// (right union (that union left)) incl elem // calls=36
// (left union (that union right)) incl elem // calls=33
// (that union (left union right)) incl elem // calls=26
// (that union (right union left)) incl elem // calls=26
//
// left union right union that incl elem // calls=13
// right union left union that incl elem // calls=13
// right union that union left incl elem // calls=56
// left union that union right incl elem // calls=74
// that union left union right incl elem // calls=77
// that union right union left incl elem // calls=90
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment