def sort_index(list):
    """
    Return the *indices* of the elements in an array in order from smallest
    element to largest, e.g sort_index([3, -1, 1]) gives [1, 2, 0].
    """
    x = zip(list, range(0, len(list)))
    x = sorted(x, key=lambda x: x[0])
    return map(lambda x: x[1], x)