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-rosetta/blob/main/exercises/luhn/.meta/example.om # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / exercises / luhn / .meta / example.om` 29 lines ยท 636 bytes Raw Blame History 1 note Exercism-style exercise "luhn": https://exercism.org/tracks/python/exercises/luhn 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note valid is true when s, after removing spaces, is at least two decimal digits (and nothing else) 4 note that pass the Luhn checksum. 5 note Check it with: sh exercise.sh exercises/luhn 6 om2 7 fn valid s view uchar * to bool 8 n = ulong 0 9 t = ulong 0 10 for i ulong len s 11 c = get s sub sub len s 1 i 12 if eq c 32 13 continue 14 end 15 if or lt c 48 gt c 57 16 ret false 17 end 18 d = ulong sub c 48 19 if eq rem n 2 1 20 d = mul d 2 21 if gt d 9 22 d = sub d 9 23 end 24 end 25 t = add t d 26 n = add n 1 27 end 28 ret and gt n 1 eq rem t 10 0 29 end