2019-06-06 22:48:36 +04:00
|
|
|
// variant defining pseudo multi-entrypoint actions
|
|
|
|
type action is
|
|
|
|
| Increment of int
|
|
|
|
| Decrement of int
|
|
|
|
|
2019-11-19 04:44:36 +04:00
|
|
|
function add (const a : int ; const b : int) : int is a + b
|
2019-06-06 22:48:36 +04:00
|
|
|
|
2019-11-19 04:44:36 +04:00
|
|
|
function subtract (const a : int ; const b : int) : int is a - b
|
2019-06-06 22:48:36 +04:00
|
|
|
|
|
|
|
// real entrypoint that re-routes the flow based on the action provided
|
2019-11-19 04:44:36 +04:00
|
|
|
function main (const p : action ; const s : int) : (list(operation) * int) is
|
|
|
|
((nil : list(operation)),
|
2019-06-06 22:48:36 +04:00
|
|
|
case p of
|
2019-06-13 18:57:40 +04:00
|
|
|
| Increment (n) -> add (s, n)
|
|
|
|
| Decrement (n) -> subtract (s, n)
|
2019-06-06 22:48:36 +04:00
|
|
|
end)
|