OCaml lists are immutable. You can't change them. There are ways to work with mutable data in OCaml--lists are immutable, but if you insist you could work with a list of mutable values. However, one of the reasons to study OCaml is to learn to work with immutable data. So that's what I'd suggest initially.
When working with immutable data, instead of changing your data you return a new version of the data that is different in the way you require. If your data is changing more than a little bit, you might want to use trees rather than lists.
Update
Let's say I want to calculate a list containing the squares of the values of my input list. One way to do it would be like this:
let rec squarelist l =
match l with
| [] -> []
| h :: t -> (h * h) :: squarelist t
In essence, this function constructs a new list (using the ::
operator) with the contents I want it to have. Usually you can use recursion to handle the tail of the list.
Your case is a little harder because you need to carry a cumulative sum. So you might need a helper function with an extra argument.