Hi, I have started to do the questions on project euler regarding lists of names which need to be replaced with their corresponding position in the alphabet. In question 22 I need to replace, the letters with numbers:
names = ["MARY","PATRICIA","LINDA"....
replace = ??????
char2num a = map replace a
score (a,b) = a * (sum $ map char2num b)
answer = sum $ map score (zip [1..] (sort names))
What I cannot find is how to replace the characters with their place in the alphabet. How would I go about making something to do the replace function (preferably not regex)?