Given two collections ``a`` and ``b``, this will return the distance of the
    points which are closest together.  ``distance_function`` is used to
    determine the distance between two elements.

    Example::

        >>> single([1, 2], [3, 4], lambda x, y: abs(x-y))
        1  # (distance between 2 and 3)

def single(a, b, distance_function):
    """
    Given two collections ``a`` and ``b``, this will return the distance of the
    points which are closest together.  ``distance_function`` is used to
    determine the distance between two elements.

    Example::

        >>> single([1, 2], [3, 4], lambda x, y: abs(x-y))
        1  # (distance between 2 and 3)
    """
    left_a, right_a = min(a), max(a)
    left_b, right_b = min(b), max(b)
    result = min(distance_function(left_a, right_b),
                 distance_function(left_b, right_a))
    return result