
29 Sep
2007
29 Sep
'07
2:23 p.m.
(sending the e-mail again, this time with CC to the list)
On 9/29/07, PR Stanley
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.