2019-05-13 00:56:22 +04:00
|
|
|
type action is
|
|
|
|
| Increment of int
|
|
|
|
| Decrement of int
|
|
|
|
|
|
|
|
function increment(const i : int ; const n : int) : int is
|
|
|
|
block { skip } with (i + n)
|
|
|
|
|
|
|
|
function decrement(const i : int ; const n : int) : int is
|
|
|
|
block { skip } with (i - n)
|
|
|
|
|
|
|
|
function main (const p : action ; const s : int) : (list(operation) * int) is
|
|
|
|
block {skip} with ((nil : list(operation)),
|
|
|
|
case p of
|
2019-06-13 18:57:40 +04:00
|
|
|
| Increment (n) -> increment (s, n)
|
|
|
|
| Decrement (n) -> decrement (s, n)
|
2019-05-13 00:56:22 +04:00
|
|
|
end)
|