erg/examples/patch.er
Shunsuke Shibayama 96132b20f6 initial commit
2022-08-10 23:02:27 +09:00

12 lines
240 B
Python

Binary = Patch {0, 1}
Binary.
invert self =
if self == 0, 1 else 0
assert 1.invert() == 0
assert 0.invert() == 1
Nat = Patch {I | I >= 0}
Nat.times! self, block! =
for! 0..<self, _ => block!()
10.times! do!:
print! "!"