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 / front / runs / p-part.om
| 1 | om2 |
| 2 | note p-part: slices into unsized parameters: a whole local array and parts of it into a view, an edit part |
| 3 | note written through, len of a slice; then a part one element too long traps 3 (omc arrpart, ΩIR chk.slice) |
| 4 | fn sum a view uint * to ulong |
| 5 | s = ulong 0 |
| 6 | for i ulong len a |
| 7 | s = add s ulong get a i |
| 8 | end |
| 9 | ret s |
| 10 | end |
| 11 | fn bump a edit uint * v uint to void |
| 12 | for i ulong len a |
| 13 | put a i add get a i v |
| 14 | end |
| 15 | end |
| 16 | fn main to int |
| 17 | b = new uint 8 0 |
| 18 | for i ulong 8 |
| 19 | put b i uint add i 1 |
| 20 | end |
| 21 | bump part b 4 2 100 |
| 22 | x = sum b |
| 23 | y = sum part b 2 3 |
| 24 | z = sum part b 6 3 |
| 25 | ret int add x y |
| 26 | end |