palindromes-0.2: Finding palindromes in strings

Portabilityportable
Stabilityexperimental
Maintainerjohan@jeuring.net

Data.Algorithms.Palindromes.Palindromes

Description

 

Synopsis

Documentation

longestPalindrome :: String -> StringSource

longestPalindrome returns the longest palindrome in a string.

longestPalindromes :: Int -> String -> StringSource

longestPalindromes returns the longest palindrome around each position in a string. The integer argument is used to only show palindromes of length at least this integer.

lengthLongestPalindrome :: String -> StringSource

lengthLongestPalindrome returns the length of the longest palindrome in a string.

lengthLongestPalindromes :: String -> StringSource

lengthLongestPalindromes returns the lengths of the longest palindrome around each position in a string.

longestTextPalindrome :: String -> StringSource

longestTextPalindrome returns the longest text palindrome in a string, ignoring spacing, punctuation symbols, and case of letters.

longestTextPalindromes :: Int -> String -> StringSource

longestTextPalindromes returns the longest text palindrome around each position in a string. The integer argument is used to only show palindromes of length at least this integer.

longestWordPalindrome :: String -> StringSource

longestWordPalindrome returns the longest text palindrome preceded and followed by punctuation symbols (if any). Note that if a word palindrome is accidentally surrounded by the same symbols, it won't be found. For example, the longest word palindrome in w waaw wo waw is waw. We could change longestWordPalindrome to return the longest enclosed word palindrome, but that would give a quadratic time algorithm.

longestWordPalindromes :: Int -> String -> StringSource

longestWordPalindromes returns the longest word palindrome around each position in a string. The integer argument is used to only show palindromes of length at least this integer.

palindromesAroundCentres :: Eq a => Array Int a -> [Int]Source

palindromesAroundCentres is the central function of the module. It returns the list of lenghths of the longest palindrome around each position in a string.