18 lines
476 B
Plaintext
18 lines
476 B
Plaintext
type parameter is
|
|
Increment of int
|
|
| Decrement of int
|
|
|
|
type storage is int
|
|
|
|
type return is list (operation) * storage
|
|
|
|
function add (const n : int; const store : storage) : storage is store + n
|
|
function sub (const n : int; const store : storage) : storage is store - n
|
|
|
|
function main (const action : parameter; const store : storage) : return is
|
|
((nil : list(operation)),
|
|
case action of
|
|
Increment (n) -> add (n, store)
|
|
| Decrement (n) -> sub (n, store)
|
|
end)
|