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 / qualification / om2 / sec / s5s7 / v6-sum.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note contract 6 lines 169-170 and erratum E2: unsized `view uchar *` parameters receive sized arrays of |
| 3 | note length 10 and 3; `len v` is the run-time length. stdout 10, 315, 3, 15 (exp/v6-sum.out, python3). |
| 4 | om2 |
| 5 | fn vsum v view uchar * to ulong |
| 6 | x = ulong 0 |
| 7 | for i ulong len v |
| 8 | x = add x ulong get v i |
| 9 | end |
| 10 | ret x |
| 11 | end |
| 12 | fn plen v view uchar * to ulong |
| 13 | ret len v |
| 14 | end |
| 15 | fn main to int |
| 16 | a = new uchar 10 0 |
| 17 | for i ulong 10 |
| 18 | put a i uchar mul i 7 |
| 19 | end |
| 20 | b = new uchar 3 5 |
| 21 | putd plen a |
| 22 | putd vsum a |
| 23 | putd plen b |
| 24 | putd vsum b |
| 25 | ret 0 |
| 26 | end |