interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / si / rosetta / tasks / repeat-a-string / repeat-a-string.om

35 lines · 738 bytes Raw Blame History
1note Rosetta Code task "Repeat a string": https://rosettacode.org/wiki/Repeat_a_string
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3om2
4text nl "\n"
5text ha "ha"
6text star "*"
7note emit writes every byte of a to stdout; a short write is retried, an error exits 1
8fn emit a view uchar * to void
9o = ulong 0
10while lt o len a bound 4096
11k = write 1 a o sub len a o
12if le k 0
13exit 1
14end
15o = add o ulong k
16end
17end
18note repeat writes a, k times, into one buffer (up to 256 bytes, more traps 3) and prints it
19fn repeat a view uchar * k ulong to void
20b = new uchar 256 0
21p = ulong 0
22for j ulong k
23for i ulong len a
24put b p get a i
25p = add p 1
26end
27end
28emit part b 0 p
29emit nl
30end
31fn main to int
32repeat ha 5
33repeat star 5
34ret 0
35end