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/raindrops/.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 / raindrops / .meta / example.om` 47 lines ยท 1019 bytes Raw Blame History 1 note Exercism-style exercise "raindrops": https://exercism.org/tracks/python/exercises/raindrops 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note convert writes "Pling" if n is divisible by 3, then "Plang" if by 5, then "Plong" if by 7, 4 note or the decimal digits of n when it is divisible by none of them, into o; returns the length. 5 note Check it with: sh exercise.sh exercises/raindrops 6 om2 7 text pling "Pling" 8 text plang "Plang" 9 text plong "Plong" 10 fn app o edit uchar * p ulong s view uchar * to ulong 11 q = p 12 for i ulong len s 13 put o q get s i 14 q = add q 1 15 end 16 ret q 17 end 18 fn appnum o edit uchar * p ulong n ulong to ulong 19 d = new uchar 20 0 20 i = ulong 20 21 v = n 22 while true bound 20 23 i = sub i 1 24 put d i uchar add rem v 10 48 25 v = div v 10 26 if eq v 0 27 break 28 end 29 end 30 ret app o p part d i sub 20 i 31 end 32 fn convert n ulong o edit uchar * to ulong 33 p = ulong 0 34 if eq rem n 3 0 35 p = app o p pling 36 end 37 if eq rem n 5 0 38 p = app o p plang 39 end 40 if eq rem n 7 0 41 p = app o p plong 42 end 43 if eq p 0 44 p = appnum o p n 45 end 46 ret p 47 end