def __new__(cls, function, **kwargs): evaluate = kwargs.pop('evaluate', global_evaluate[0]) if not is_Function(function): raise TypeError('function is not a FunctionClass, Functor or Lambda: %s'%function) if evaluate: return FunctionInverse.eval(function) return Functor.__new__(cls, function)
def __new__(cls, *functions, **kwargs): evaluate = kwargs.pop('evaluate', global_evaluate[0]) for function in functions: if not is_Function(function): raise TypeError('function is not a FunctionClass, Functor or Lambda: %s'%function) if evaluate: functions = FunctionCompose.reduce(functions) if len(functions) == 0: return Id elif len(functions) == 1: return functions[0] else: return Functor.__new__(cls, *functions)