I'm writing a function that takes an int list and returns a sum using scanl
Below code works.
Input: [1,2,3]
sum_calc list = scanl (+) 0 [1..10]
Output: [0,1,3,6,10,15,21,28,36,45,55]
I want to edit it so that the output only goes up to the last element of the inputted list. I've tried using 0 [1..length list] but haskell spits this out at me.
sum_calc [1, 2, 3]? Just6?sum_calc [1, 2, 3] == [0, 1, 3](i.e. the cumulative sums of the list).sum_calcas it is currently written, it returns the cumulative sums of the list[1..10]rather than those of the input listlist. How can you alter your code to use the input list?