omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / drafts / rosettacode / pangram-checker.wiki
| 1 | =={{header|Omegese}}== |
| 2 | {{works with|omc|sha256 2c824805, aien-dev/omega-mv e5b32567, Linux AArch64}} |
| 3 | Omega has no imports, so the small output helpers (<code>emit</code> and friends) are part of the program. |
| 4 | <syntaxhighlight lang="text"> |
| 5 | om2 |
| 6 | text nl "\n" |
| 7 | text tq "\"" |
| 8 | text tis "\" is a pangram\n" |
| 9 | text tnot "\" is not a pangram\n" |
| 10 | text p1 "The quick brown fox jumps over the lazy dog" |
| 11 | text p2 "The quick brown fox jumped over the lazy dog" |
| 12 | text p3 "Pack my box with five dozen liquor jugs." |
| 13 | note emit writes every byte of a to stdout; a short write is retried, an error exits 1 |
| 14 | fn emit a view uchar * to void |
| 15 | o = ulong 0 |
| 16 | while lt o len a bound 4096 |
| 17 | k = write 1 a o sub len a o |
| 18 | if le k 0 |
| 19 | exit 1 |
| 20 | end |
| 21 | o = add o ulong k |
| 22 | end |
| 23 | end |
| 24 | fn pangram a view uchar * to bool |
| 25 | seen = new uchar 26 0 |
| 26 | for i ulong len a |
| 27 | c = get a i |
| 28 | if and ge c 65 le c 90 |
| 29 | c = add c 32 |
| 30 | end |
| 31 | if and ge c 97 le c 122 |
| 32 | put seen sub c 97 1 |
| 33 | end |
| 34 | end |
| 35 | for j ulong 26 |
| 36 | if eq get seen j 0 |
| 37 | ret false |
| 38 | end |
| 39 | end |
| 40 | ret true |
| 41 | end |
| 42 | fn show a view uchar * to void |
| 43 | emit tq |
| 44 | emit a |
| 45 | if pangram a |
| 46 | emit tis |
| 47 | else |
| 48 | emit tnot |
| 49 | end |
| 50 | end |
| 51 | fn main to int |
| 52 | show p1 |
| 53 | show p2 |
| 54 | show p3 |
| 55 | ret 0 |
| 56 | end |
| 57 | </syntaxhighlight> |
| 58 | {{out}} |
| 59 | <pre> |
| 60 | "The quick brown fox jumps over the lazy dog" is a pangram |
| 61 | "The quick brown fox jumped over the lazy dog" is not a pangram |
| 62 | "Pack my box with five dozen liquor jugs." is a pangram |
| 63 | </pre> |