17 lines
443 B
Plaintext
17 lines
443 B
Plaintext
|
type action is
|
||
|
| Increment of int
|
||
|
| Decrement of int
|
||
|
|
||
|
function add (const a : int ; const b : int) : int is
|
||
|
block { skip } with a + b
|
||
|
|
||
|
function subtract (const a : int ; const b : int) : int is
|
||
|
block { skip } with a - b
|
||
|
|
||
|
function main (const p : action ; const s : int) : (list(operation) * int) is
|
||
|
block {skip} with ((nil : list(operation)),
|
||
|
case p of
|
||
|
| Increment n -> add(s, n)
|
||
|
| Decrement n -> subtract(s, n)
|
||
|
end)
|