omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / exercises / reverse-string / .meta / example.om
| 1 | note Exercism-style exercise "reverse-string": https://exercism.org/tracks/python/exercises/reverse-string |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note reverse writes the bytes of s into o in reverse order and returns the length. |
| 4 | note Check it with: sh exercise.sh exercises/reverse-string |
| 5 | om2 |
| 6 | fn reverse s view uchar * o edit uchar * to ulong |
| 7 | n = len s |
| 8 | for i ulong n |
| 9 | put o i get s sub sub n 1 i |
| 10 | end |
| 11 | ret n |
| 12 | end |