I'm using the following code to try and put the average of consecutive numbers in an integer list into a new list:
let newList = [] let rec average2 xs = match xs with | [] -> newList | x :: [] -> newList | x :: x' :: [xs] -> append newList [((x + x')/2)] average2 x' :: [xs];; but I keep getting the following error and don't understand why: Error: This function has type 'a list -> 'a list -> 'a list It is applied to too many arguments; maybe you forgot a `;'.
newList? It's always an empty list.newListis constant and it's never read from in the code.appendfunction returns a new list where the first list is appended to the second list. No arguments will get mutated.