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 / ng / a64 / tests / ref / tsum.om
| 1 | note tsum: ts(n) = ts(n - 1) + n, ts(0) = 0, on ulong (Omega wraps unsigned values: no check). ts(1000000) is |
| 2 | note 500000500000 (Wolfram), more than 2^31 - 1, so main takes its low byte before `int` (whose check, chk.conv |
| 3 | note trap 5, would otherwise fail): status 32. Under omc the recursion is a million calls deep and traps 6 (exit 106). |
| 4 | fn ts n ulong to ulong |
| 5 | if lt n 1 |
| 6 | ret n |
| 7 | end |
| 8 | r = ts sub n 1 |
| 9 | ret add r n |
| 10 | end |
| 11 | fn main to int |
| 12 | ret int and ts 1000000 255 |
| 13 | end |