old easter egg

Ashley Yakeley ashley@semantic.org
Sat, 2 Dec 2000 11:08:53 -0800


At 2000-12-01 13:08, Ronald Kuwawi wrote:

>open text editor, type
>hash :: [Char] -> Int
>hash = (foldl (+) 0) . (map ord)
>
>save as hash.hs
>
>load script, type:
>hash "MSDOS 6.000"
>
>or 
>
>hash "SYSTEM 7.0"

It's not really an easter egg, is it? It's more a modern form of 
numerology. I was hoping to see the hugs environment show me a little 
dancing bunny animation or something.

letter c | ord c <= 64 = 0
letter c | ord c <= 90 = ord c - 64
letter c | ord c <= 96 = 0
letter c | ord c <= 122 = ord c - 96
letter c | otherwise = 0

renum n | n == 0 = 0
renum n | otherwise = (mod ((n - 1) * 19) 26) + 1

engql c = renum (letter c)

engq = (foldl (+) 0) . (map engql)


-- 
Ashley Yakeley, Seattle WA