nac3-spec/toy-impl/examples/a.py

15 lines
261 B
Python
Raw Normal View History

2020-12-23 10:34:56 +08:00
I = TypeVar('I', int32, int64)
class Vec:
v: list[int32]
def __init__(self, v: list[int32]):
self.v = v
def __add__(self, other: int32) -> Vec:
return Vec([v + other for v in self.v])
def addI(a: I, b: I) -> I:
return a + b