How can I make a function similar to this but with n being a variable with a number beginning in 1 and ending with the value of the length of xs?
For Example I want [1,2,3] to return the result of 3*1 + 2*2 + 1*3.
function :: [Int] -> Int
function xs = foldr (\x acc -> (x*n) + acc) 0 xs