
29 Sep
2007
29 Sep
'07
2:37 p.m.
Okay, a couple of things
what is fromEnum?
What's the role of % in length 5 takeWhile ( On Sat, Sep 29, 2007 at 03:11:20PM +0100, PR Stanley wrote: Hi
ord :: Char -> Int
ord c = sum [1 | x <- ['\0'..'\255'], x < c] Any comments? Any alternatives?
Cheers, Paul It's waay slow, it breaks for characters >255. ord :: Char -> Int
ord = fromEnum As Char is an instance of 'Enum'. If you think this is cheating, then consider that (<) for Char is
probably implemented using ord on some level. You need primitives
somewhere... Stefan