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/si/rosetta/exercises/isbn-verifier/.meta/example.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 / si / rosetta / exercises / isbn-verifier / .meta / example.om` 32 lines ยท 748 bytes Raw Blame History 1 note Exercism-style exercise "isbn-verifier": https://exercism.org/tracks/python/exercises/isbn-verifier 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note isvalid is true when isbn, with its hyphens removed, is a valid ISBN-10: nine digits and a check 4 note digit or X (10), such that d1*10 + d2*9 + ... + d10*1 is divisible by 11. 5 note Check it with: sh exercise.sh exercises/isbn-verifier 6 om2 7 fn isvalid isbn view uchar * to bool 8 k = ulong 0 9 t = ulong 0 10 for i ulong len isbn 11 c = get isbn i 12 if eq c 45 13 continue 14 end 15 d = ulong 0 16 if and ge c 48 le c 57 17 d = ulong sub c 48 18 else 19 if and eq c 88 eq k 9 20 d = ulong 10 21 else 22 ret false 23 end 24 end 25 if ge k 10 26 ret false 27 end 28 t = add t mul d sub 10 k 29 k = add k 1 30 end 31 ret and eq k 10 eq rem t 11 0 32 end