Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/ng/front/runs/isort-s.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / ng / front / runs / isort-s.om` 66 lines ยท 1304 bytes Raw Blame History 1 note isort-s: kernels/isort.om with 4000 numbers (was 20000), for ngrun in gate-front-ir. isort: 2 note insertion sort of numbers from the generator of seed/rung4/tests/sort.om, in a 3 note global array; prints sum a[i]*(i+1), the count of unsorted neighbours, a[0] and a[3999]. 4 note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without 5 note start-up and output) as one decimal line on stderr; stdout is unchanged. 6 global out uchar 32 7 global a ulong 4000 8 fn putnum fd int v ulong to void 9 put out 31 10 10 p = ulong 31 11 x = v 12 while gt x 9 13 p = sub p 1 14 put out p uchar add rem x 10 48 15 x = div x 10 16 end 17 p = sub p 1 18 put out p uchar add x 48 19 w = write fd out p sub 32 p 20 end 21 fn gen to void 22 x = ulong 12345 23 for i ulong 4000 24 x = rem add mul x `1103515245` 12345 `2147483648` 25 put a i rem x 100000 26 end 27 end 28 fn isort to void 29 for j ulong 4000 30 v = get a j 31 k = j 32 moving = true 33 while and moving gt k 0 34 p = get a sub k 1 35 if gt p v 36 put a k p 37 k = sub k 1 38 else 39 moving = false 40 end 41 end 42 put a k v 43 end 44 end 45 fn main to int 46 t0 = monons 47 gen 48 isort 49 s = ulong 0 50 for i ulong 4000 51 s = add s mul get a i add i 1 52 end 53 bad = ulong 0 54 for i ulong 3999 55 if gt get a i get a add i 1 56 bad = add bad 1 57 end 58 end 59 t1 = monons 60 putnum 2 ulong sub t1 t0 61 putnum 1 s 62 putnum 1 bad 63 putnum 1 get a 0 64 putnum 1 get a 3999 65 ret 0 66 end