Files
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

21 lines
677 B
Mojo

# probe: codepoint indexing, lower(), and early returns
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: Level True
# expect-stdout: rotor True
# expect-stdout: Mojo False
# expect-stdout: a True
# expect-stdout: True
# expect-stdout: abBA True
def is_palindrome(s: String) -> Bool:
var t = s.lower()
var n = t.count_codepoints()
for i in range(n // 2):
if String(t[codepoint=i]) != String(t[codepoint=n - 1 - i]):
return False
return True
def main():
for w in ["Level", "rotor", "Mojo", "a", "", "abBA"]:
print(w, is_palindrome(w))