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 / isogram / .meta / example.om
| 1 | note Exercism-style exercise "isogram": https://exercism.org/tracks/python/exercises/isogram |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note isisogram is true when no letter occurs twice in s, ignoring case; spaces and hyphens may repeat. |
| 4 | note Check it with: sh exercise.sh exercises/isogram |
| 5 | om2 |
| 6 | fn isisogram s view uchar * to bool |
| 7 | seen = new uchar 26 0 |
| 8 | for i ulong len s |
| 9 | c = get s i |
| 10 | if and ge c 65 le c 90 |
| 11 | c = add c 32 |
| 12 | end |
| 13 | if and ge c 97 le c 122 |
| 14 | k = ulong sub c 97 |
| 15 | if ne get seen k 0 |
| 16 | ret false |
| 17 | end |
| 18 | put seen k 1 |
| 19 | end |
| 20 | end |
| 21 | ret true |
| 22 | end |