(sending the e-mail again, this time with CC to the list) On 9/29/07, PR Stanley <[EMAIL PROTECTED]> wrote: > Hi > ord :: Char -> Int > ord c = sum [1 | x <- ['\0'..'\255'], x < c] > > Any comments? Any alternatives?
Well, you're using Enum class there, so maybe you want ord' = fromEnum Also, an alternative is to stop the loop as soon as possible ord'' c = length $ takeWhile (< c) ['\0'..'\255'] Humm... and it seems that you can have Char's above '\255', so it would be wiser to use ord''' c = length $ takeWhile (< c) ['\0'..] -- Felipe. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
