Reworked the implementation of join.

Replaced the `innerKey` and `outerKey` functions by an `on` function,
which returns a bool.

Not only does that make it more readable, but also more generic (since
the comparison no longer has to rely on an overloaded notion of
equality).