Skip to content

Instantly share code, notes, and snippets.

@priort

priort/HaskellIntro4.hs Secret

Created Dec 30, 2018
Embed
What would you like to do?
isPalindromeWithRecursionAndGuard :: String -> Bool
isPalindromeWithRecursionAndGuard str =
loop strEndIndex where
strEndIndex = length str - 1
loop i
| i <= (div strEndIndex 2) = True
| (str !! i) /= str !! (strEndIndex - i) = False
| otherwise = loop (i - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.