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 / loop_toggle.om
| 1 | note loop_toggle.om: put and get on a bool field inside a loop. Seven flips from false end true; |
| 2 | note the count of times the field read true on the way is 3. Result 3 * 10 + 1. |
| 3 | struct W n uint f bool end |
| 4 | fn main to uint |
| 5 | w = new W 0 false |
| 6 | for i uint 7 |
| 7 | if eq get w f true |
| 8 | put w n add get w n 1 |
| 9 | end |
| 10 | if eq get w f true |
| 11 | put w f false |
| 12 | else |
| 13 | put w f true |
| 14 | end |
| 15 | end |
| 16 | r = mul get w n 10 |
| 17 | if eq get w f true |
| 18 | r = add r 1 |
| 19 | end |
| 20 | ret r |
| 21 | end |