def __init__(self, value): ''' Initialize a new instance of the ConstantGroup :param value: The constant value to operate with ''' super(ConstantGroup, self).__init__(**{ 'zero': value, 'lift': combinator.constant(value), 'plus': combinator.constant2(value), 'negate': combinator.constant(value), 'minus': combinator.constant(value), })
def unit(klass, value): return klass(constant(value))
def __init__(self, value): if not callable(value): value = constant(value) self.value = value