RosettaCodeData/Task/Palindrome-detection/Groovy/palindrome-detection-4.groovy
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

5 lines
129 B
Groovy

def isPalindrome
isPalindrome = { String s ->
def n = s.size()
n < 2 || (s[0] == s[n-1] && isPalindrome(s[1..<(n-1)]))
}