def _PrefixMinima(X,reversed=False):
    """Compute table of prefix minima
    (or suffix minima, if reversed=True) of list X.
    """
    current = None
    output = [None]*len(X)
    for x,i in _pairs(X,reversed):
        if current is None:
            current = x
        else:
            current = min(current,x)
        output[i] = current
    return output
Compute table of prefix minima
    (or suffix minima, if reversed=True) of list X.
    
recipes/Python/252123_Range_minimleast/recipe-252123.py