I am pretty new to F# and learning lists.I am having a hard time trying to implement my own reduce function. I've been stuck trying to implement this one. This is what I have so far but I am getting an error that when calling reduce saying that the list i pass in is type is type int but should be type 'a list. I've been super frustrated with this one so any help is welcome.
Here is what my code looks like:
let reduce Fn (list: 'a list) =
let rec innerFun list acc =
match list with
| (x::xs) :: xss ->
let newAcc = Fn x xs // the fn applied to the head and the next element
innerFun xss newAcc // recurse through the list with new accumulator
| [] -> acc // if the list is empty return the accumulator
innerFun list 0
//Calling reduce
let red2 = reduce (fun x y -> x*y) [23; 4]