omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / omc / tests / struct-bool / func_value.om
| 1 | note func_value.om: a bool field set from the value of a function call, in new and in put. |
| 2 | note big(5) is true and big(2) is false: new with true -> 1, put false -> 2, put true -> 4, a=3. |
| 3 | struct W a uint f bool end |
| 4 | fn big x uint to bool |
| 5 | ret gt x 3 |
| 6 | end |
| 7 | fn main to uint |
| 8 | w = new W 3 big 5 |
| 9 | r = uint 0 |
| 10 | if eq get w f true |
| 11 | r = add r 1 |
| 12 | end |
| 13 | put w f big 2 |
| 14 | if eq get w f false |
| 15 | r = add r 2 |
| 16 | end |
| 17 | put w f big 9 |
| 18 | if eq get w f true |
| 19 | r = add r 4 |
| 20 | end |
| 21 | ret add r sub get w a 3 |
| 22 | end |