nim: Use inc() and dec()

This commit is contained in:
Rupus Reinefjord 2020-12-28 12:56:40 +01:00
parent e483d930d6
commit a7fe5c186b

View file

@ -22,16 +22,16 @@ type
cs: seq[Command] cs: seq[Command]
proc incrementHead(t: Tape) = proc incrementHead(t: Tape) =
t.head = t.head + 1 t.head.inc
proc decrementHead(t: Tape) = proc decrementHead(t: Tape) =
t.head = t.head - 1 t.head.dec
proc incrementCell(t: Tape) = proc incrementCell(t: Tape) =
t.cells[t.head] = t.cells[t.head] + 1 t.cells[t.head].inc
proc decrementCell(t: Tape) = proc decrementCell(t: Tape) =
t.cells[t.head] = t.cells[t.head] - 1 t.cells[t.head].dec
proc print(t: Tape) = proc print(t: Tape) =
stdout.write(chr(t.cells[t.head])) stdout.write(chr(t.cells[t.head]))