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 / si / rosetta / exercises / nucleotide-count / .meta / example.om
| 1 | note Exercism-style exercise "nucleotide-count": https://exercism.org/tracks/python/exercises/nucleotide-count |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note nucleotidecounts writes how many A, C, G and T the DNA strand holds into o[0] .. o[3] and is |
| 4 | note true; it is false when the strand holds any other byte. |
| 5 | note Check it with: sh exercise.sh exercises/nucleotide-count |
| 6 | om2 |
| 7 | fn nucleotidecounts strand view uchar * o edit ulong * to bool |
| 8 | for j ulong 4 |
| 9 | put o j 0 |
| 10 | end |
| 11 | for i ulong len strand |
| 12 | c = get strand i |
| 13 | k = ulong 4 |
| 14 | if eq c 65 |
| 15 | k = ulong 0 |
| 16 | end |
| 17 | if eq c 67 |
| 18 | k = ulong 1 |
| 19 | end |
| 20 | if eq c 71 |
| 21 | k = ulong 2 |
| 22 | end |
| 23 | if eq c 84 |
| 24 | k = ulong 3 |
| 25 | end |
| 26 | if eq k 4 |
| 27 | ret false |
| 28 | end |
| 29 | put o k add get o k 1 |
| 30 | end |
| 31 | ret true |
| 32 | end |