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 / train / omega-llm / tools / contrast / select.om

87 lines · 1421 bytes Raw Blame History
1note select EXAMPLE_PANEL OMC FIRST_DIR SECOND_DIR THIRD_DIR [compile]. Each directory contains answer-N.
2note Use a fresh working directory. Selected function bodies are written as answer-N for independent grading.
3text slash "/"
4text compilearg "compile"
5fn copyanswer a ulong j ulong to void
6wdpclr
7wdpa a
8wdpt slash
9wdpt outname
10wdpd j
11fi = wdopen 0 0
12if lt fi 0
13exit 74
14end
15pathfor j
16fo = wdopen 577 384
17if lt fo 0
18exit 74
19end
20wdcopyfd fi fo
21ca = fclose fi
22cb = fclose fo
23end
24fn choose src view uchar 262144 tape view uint 262144 obj ulong j ulong to ulong
25for k ulong 3
26copyanswer add k 3 j
27grade = testrow src tape obj j
28if or eq grade 2 and eq argcnt 7 eq grade 1
29ret add k 1
30end
31end
32pathfor j
33empty = wdopen 577 384
34if lt empty 0
35exit 74
36end
37cl = fclose empty
38ret 0
39end
40fn main to int
41if and ne argcnt 6 ne argcnt 7
42ret 2
43end
44if eq argcnt 7
45if not argis 6 compilearg
46ret 2
47end
48end
49src = new uchar 262144 0
50tape = new uint 262144 0
51wdpclr
52wdpa 1
53fd = wdopen 0 0
54if lt fd 0
55ret 70
56end
57n = read fd src 0 len src
58cl = fclose fd
59if or lt n 1 eq n long len src
60ret 72
61end
62if lt js_init tape 262144 128 0
63ret 72
64end
65if lt js_parse src tape ulong n 0
66ret 72
67end
68if ne js_type tape 0 jsarr
69ret 72
70end
71obj = js_first tape 0
72j = ulong 0
73while ne obj jsnone bound 4294967295
74chosen = choose src tape obj j
75wdod j
76wdot sep
77wdod chosen
78wdot lf
79wdoflush 1
80j = add j 1
81obj = js_enext tape obj
82end
83if eq j 0
84ret 72
85end
86ret 0
87end