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
omega-mv / train / omega-llm / tools / contrast / with-example.om
| 1 | note with-example PROMPT OMC SAMPLER MERGES EXAMPLE_MAIN CK [CK ...] |
| 2 | note EXAMPLE_MAIN defines a seeded main that returns 77 for success. Use a fresh working directory. |
| 3 | text genfile "sample.raw" |
| 4 | text okmsg "accepted checkpoint " |
| 5 | text none "no generated answer passed the example\n" |
| 6 | fn draw p view uchar * j ulong a edit uchar * to ulong |
| 7 | fd = fdesc genfile 577 |
| 8 | wdkclr |
| 9 | wdka 3 |
| 10 | wdkt samplecmd |
| 11 | wdka add 6 j |
| 12 | wdkt seedval |
| 13 | wdkt limitval |
| 14 | wdkt tempval |
| 15 | wdkt p |
| 16 | wdka 4 |
| 17 | rc = wdwait wdspawn -1 fd -1 |
| 18 | cl = fclose fd |
| 19 | if ne rc 0 |
| 20 | exit 73 |
| 21 | end |
| 22 | ret pickread fdesc genfile 0 a |
| 23 | end |
| 24 | fn accepted p view uchar 4096 a view uchar * n ulong c view uchar 65536 to bool |
| 25 | for i ulong n |
| 26 | if terminates part a 0 n i |
| 27 | if eq compile p part a 0 add i 1 c 0 |
| 28 | r = strict |
| 29 | if or eq r 125 eq r 126 |
| 30 | exit 70 |
| 31 | end |
| 32 | if eq r 77 |
| 33 | wdwrall 1 a add i 1 |
| 34 | wdwrall 1 lf 1 |
| 35 | ret true |
| 36 | end |
| 37 | break |
| 38 | end |
| 39 | end |
| 40 | end |
| 41 | ret false |
| 42 | end |
| 43 | fn main to int |
| 44 | if lt argcnt 7 |
| 45 | ret 2 |
| 46 | end |
| 47 | p = new uchar 4096 0 |
| 48 | a = new uchar 8192 0 |
| 49 | c = new uchar 65536 0 |
| 50 | pn = pickload 1 p |
| 51 | put lengths 0 pn |
| 52 | put lengths 2 pickload 5 c |
| 53 | for j ulong sub ulong argcnt 6 |
| 54 | n = draw part p 0 pn j a |
| 55 | if accepted p a n c |
| 56 | wdot okmsg |
| 57 | wdod add j 1 |
| 58 | wdot lf |
| 59 | wdoflush 2 |
| 60 | ret 0 |
| 61 | end |
| 62 | end |
| 63 | wdwrall 2 none len none |
| 64 | ret 3 |
| 65 | end |