Talk:Palindrome detection: Difference between revisions

Line 6:
 
: I think what is meant is that the function itself shouldn't ignore spaces or punctuations, but if using the given example, the test code must remove spaces and convert to either uppercase or lowercase, because otherwise the example isn't a character-wise palindrome. I think it would make more sense to use some example which already is a character-wise palindrome by itself, say the German word "nennen" (to name). --[[User:Ce|Ce]] 09:42, 6 December 2008 (UTC)
 
:: It is what I've meant... As example of palindrome I used "In girum imus ..." just because it is the longest I know by heart: the "ignore or strip spaces" refers to that example as I wrote there; looking at the code it is clear what I've meant. According to me a function that tests the palindromicity of a "arbitrary" sequence is more general than one that "ignores" by design some characters; you can use the function you wrote to test palindromicity on "In girum imus nocte ...", provided that you strip spaces and make the case of all letters the same... outside the function, e.g. is_palindrome(stripchars(string)), and write stripchars according to any need. In the codes, I did it by hand coding the test string as "ingirumimusnocte...", that is less readable, but in this way I had not to write a stripchars function just to test!
 
==Haskell recursive solution note==