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 / seed / omc / om2 / s4 / p-ok.om

60 lines · 1088 bytes Raw Blame History
1note S4 part (spec 6): parts of a local (an edit), of an unsized edit, of an unsized view and of a
2note text; `view part` of an edit; an empty part at the end; a part passed to an inline function; o and k
3note from calls. The callee sees len = k and elements o .. o+k-1. Exit 0 when every check holds.
4om2
5text msg "0123456789"
6fn plen v view uchar * to ulong
7ret len v
8end
9fn first v view uchar * to ulong
10ret ulong get v 0
11end
12fn fill e edit uchar * c uchar to ulong
13for i ulong len e
14put e i c
15end
16ret add plen view part e 1 1 len e
17end
18fn ifirst v view uchar * to ulong inline
19ret ulong get v 0
20end
21fn sub2 v view uchar * o ulong to ulong
22ret first part v o 2
23end
24fn two to ulong
25ret 2
26end
27fn main to int
28a = new uchar 10 46
29if ne fill part a 3 4 88 5
30ret 1
31end
32if ne get a 2 46
33ret 2
34end
35if ne get a 6 88
36ret 3
37end
38if ne get a 7 46
39ret 4
40end
41if ne first part msg 7 3 55
42ret 5
43end
44if ne sub2 msg 4 52
45ret 6
46end
47if ne plen part a 10 0 0
48ret 7
49end
50if ne ifirst part msg 9 1 57
51ret 8
52end
53if ne plen part a two add two 1 3
54ret 9
55end
56if ne ifirst view part a 6 two 88
57ret 10
58end
59ret 0
60end