On Wed, Dec 16, 2009 at 2:55 PM, Daniel Fischer
<[email protected]> wrote:
> unCamel :: String -> String
> unCamel ('<':cs) = '<' : inTag cs
> unCamel (a:b:c:cs)
> | isLower a && isUpper b && isLower c = a : '_' : toLower b : c : unCamel
> unCamel (a:[email protected](b:cs))
> | isLower a && isUpper b = a : '_' : b : unCamel cs
> | otherwise = a : unCamel bs
> unCamel cs = cs
Excuse my pedantry, but: writeToList -> write_toList.
I think the third equation needs to be:
> unCamel (a:b:[email protected](c:_))
> | isLower a && isUpper b && isLower c = a : '_' : toLower b : unCamel cs
so that the third character is not ignored in subsequent parses.
By the way, I like camelCase because I think that in most cases you
*don't* want to break identifiers up into their component words - you
read and understand what the function does once, and then you use it
as a word in its own right. Any resemblance to actual English is
really just a mnemonic of sorts.
Haskell-Cafe mailing list