Skip to content

Instantly share code, notes, and snippets.

@priort

priort/HaskellIntro3.hs Secret

Last active Dec 30, 2018
Embed
What would you like to do?
isPalindromeWithRecursion :: String -> Bool
isPalindromeWithRecursion str =
loop strEndIndex where
strEndIndex = length str - 1
loop i =
if (i <= (div strEndIndex 2)) then True
else if (str !! i) /= str !! (strEndIndex - i) then False
else 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.