>>>>> "Eric" == Eric G Miller <egm2@jps.net> writes:
Eric> On Fri, Dec 08, 2000 at 11:16:11AM -0700, Hubert Chan wrote: >> It all depends on what you mean when you say "word". I used it in the >> abstract sense, which is just a string of characters. So abcba is a >> word, even though it is not an English word. >> >> Strictly, "A Man, a Plan, a Canal, Panama" is not a palindrome if you're >> talking about abstract words, because of commas and spaces, but >> "amanaplanacanalpanama" is. (And "amanaplanacanalpanama" is also a word >> in the abstract sense.) But if you want to treat spaces, punctuation, >> and capitalization as irrelevant decorations, then you could say that "A >> Man, a Plan, a Canal, Panama" is the same as "amanaplanacanalpanama" and >> is a palindrome. Eric> Yes, but the definition of palindrome according to two English Eric> language references (Webster's, Oxford Companion) say they can be Eric> words, sentences or verse and allthough neither are clear about Eric> punctuation and capitalization, the're are examples that ignore these Eric> things. I'd hardly call spaces, punctuation and capitalization Eric> "irrelevant decorations". I only made the mention because Eric> identifying a palindrome involves *more* than just determining if a Eric> sequence of characters is the same in forward and reverse (since Eric> people don't seem to strictly adhere to that idea in practice). In my compiler course (and I think any time I've heard a discussion on abstract languages), a palindrome has always been understood as something that is exactly the same forwards and backwards. Abstract languages (a "language" is a set of "words", a "word" is a string of "characters") don't have the notion of spacing, capitalization, or punctuation. All characters are equal. (Abstract languages don't have a notion of stringing words together to form sentences. In an abstract language sense, this whole message would be considered a single word.) The "irrelevant decorations" remark was because of this - you would have to treat certain characters as special in order to treat other things as palindromes. When speaking of English language, I agree that things get a bit more complicated. Yes, Webster's (1913) says that a palindrome is "A word, verse, or sentence, that is the same when read backward or forward." Of course, that raises the question, if you read "A Man, a Plan, a Canal, Panama" backwards, do you get the same thing, or do you read "amanap, lanac a, nalp a, nam a"? I think Webster's definition is certainly open to some interpretation, and certainly, ignoring punctuation, spaces, capitalization is a valid interpretation. When speaking in a non-abstract-language context, I, personally, would consider "A Man, a Plan, a Canal, Panama" to be a palindrome, but in an abstract language context, I would consider it to not be a palindrome. Regular expressions fall into the abstract language area, hence my original definition of a palindrome. If we hadn't been discussing regular expressions, I probably would use a definition similar to yours. Your point is well taken, that recognizing palindromes may involve more than just comparing letters. My point is just that it depends on your exact definition of what a palindrome is, and if you are dealing with abstract languages, or natural languages. Hubert -- ____ | ----------------------------------------------------------- | / --+-- | / ___|___ Hubert Chan <[EMAIL PROTECTED]> | \ | _|_ | |__| |__|__| GCS/M d- s:- a-- C++ UL+(++++) P++ L++ E++ W++ N++ o? | | K? w--- O++ M- V- PS-- PE+++ Y+ PGP+ t+ 5 X R- tv+ b+ | / | \ DI++++ D G e++ h! !r !y | / | \ | | <><------------------ http://www.crosswinds.net/~hackerhue/ PGP/GnuPG fingerprint: 6CC5 822D 2E55 494C 81DD 6F2C 6518 54DF 71FD A37F Key can be found at http://www.crosswinds.net/~hackerhue/hackerhue.asc