21 Jul
2023
21 Jul
'23
6:19 a.m.
# wonder stuff class Expr: def __init__(self, name, call, inverse = None): self.name = name self.call = call if inverse is not None: self.inverse = inverse inverse.inverse = self # note there can be more than one inverse; is more general # to think of inputs and outputs together and describe how they swizzle plus = Expr('+', lambda x, y: x + y) minus = Expr('-', lambda x, y: x - y, plus) class Const(Expr):