def getRecallPointsAndPrecisionAt(relevants, results, point=10):
    """
    Calculate the recall points based on the list of known relevants, and a
    list of results, while also calculating the precision at point.

    Precision and recall values belong in the interval [0, 1].

    param relevants: a list with ids of documents representing the ground truth
    of relevants.
    param results: a list of ids of documents returned by a query.
    param point: the point to calculate the precision at (P@K) value.
    return: a tuple (list, number), where the list is the non interpolated
    recall points list, the points are (precision, recall). The number is the
    value of the precision at the point param point.
    """
    recallPoints = []
    relevants = set(relevants) # place relevants in a set for faster lookup
    N = len(relevants)
    relevantDocs = 0
    pAtPoint = 0

    for iii, docId in enumerate(results):
        if docId in relevants:
            relevantDocs += 1
            precision = relevantDocs / (iii + 1)
            try:
                recall = relevantDocs / N
            except ZeroDivisionError:
                raise ValueError("The list of relevants can't be empty")
            recallPoints.append((precision, recall))
        if iii == (point - 1) or (iii == len(results) - 1 and len(results) < point):
            pAtPoint = relevantDocs / point

    return recallPoints, pAtPoint