Haskell - mapping the odd placed values and the even placed values differently
- by Abstract
Hey guys,
is there an easy way. To take a list of numbers, say 123456. Then multiply the odd placed by three and the even placed by 1.
i.e. (1 * 3) + (2 * 1) + (3 * 3) + (4*1) + (5*3) + (6*1)
i was thinking the map function somewhere along the lines. But i don't know how to map *3 to just the odd placed values. Oh and if you could give me the version not in prelude that would be great like the actual function or functions, as if its being imported from an external haskell file
Thanks for the help