interplane.Get Omega
Read in your language

omega-harness

Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories

Brought by drakestapleton

branch main Branches Tags History

omega-harness / examples / om2_tour.om

43 lines · 784 bytes Raw Blame History
1note om2_tour: layout, abstract/holds/seal/open, fresh, unroll (after omega-mv examples/om2-tour.om)
2om2
3layout blk 8
4field lo uint at 0 little
5field hi uint at 4 big
6end
7abstract v32 ulong
8holds v32 dup32
9note the erasing constructor: the body is exactly this line
10fn v32mk x uint to v32
11ret seal v32 or shl ulong x 32 ulong x
12end
13note fresh: every element is written before it is read (error 27 otherwise)
14fn seed s edit uint 8 fresh to uint
15for i uint 8 unroll
16put s i mul i 3
17end
18ret get s 7
19end
20fn stamp c edit blk to void
21put c lo 0x01020304
22put c hi 0x05060708
23end
24fn main to int
25s = new uint 8 0
26v = seed s
27if ne v 21
28ret 1
29end
30c = new uchar 8 0
31stamp c
32if ne get c 0 0x04
33ret 2
34end
35if ne get c 4 0x05
36ret 3
37end
38u = open v32mk 7
39if ne u 0x0000000700000007
40ret 4
41end
42ret 0
43end