def constant(c):
    """
    Return a function which returns a constant `c`.
    
    `c` can only be either a scalar, or an array-like object with the shape matching the expected argument.
    """
    return lambda x:x*0+c