nim: Use inc() and dec()
This commit is contained in:
parent
e483d930d6
commit
a7fe5c186b
1 changed files with 4 additions and 4 deletions
|
@ -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]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue