Exemplo n.º 1
0
    def apply(self, f, i, evaluation):
        "Default[f_, i___]"

        i = i.get_sequence()
        if len(i) > 2:
            evaluation.message("Default", "argb", 1 + len(i), 1, 3)
            return
        i = [index.get_int_value() for index in i]
        for index in i:
            if index is None or index < 1:
                evaluation.message("Default", "intp")
                return
        name = f.get_name()
        if not name:
            evaluation.message("Default", "sym", f, 1)
            return
        result = get_default_value(name, evaluation, *i)
        return result
Exemplo n.º 2
0
    def apply(self, f, i, evaluation):
        'Default[f_, i___]'

        i = i.get_sequence()
        if len(i) > 2:
            evaluation.message('Default', 'argb', 1 + len(i), 1, 3)
            return
        i = [index.get_int_value() for index in i]
        for index in i:
            if index is None or index < 1:
                evaluation.message('Default', 'intp')
                return
        name = f.get_name()
        if not name:
            evaluation.message('Default', 'sym', f, 1)
            return
        result = get_default_value(name, evaluation, *i)
        return result