Built-in
say "noon".is_palindrome # true
Non-recursive
func palindrome(s) { s == s.reverse }
Recursive
func palindrome(s) { if (s.len <= 1) { true } elsif (s.first != s.last) { false } else { __FUNC__(s.first(-1).last(-1)) } }
Last updated 1 year ago