I have the following function table which takes a list of tuples (x's are strings and y's are a list of strings) and I want to return a tuple of x1 and the length of the list y1. I tried it with this simple function:
let rec table lst = function
| [] -> []
| [(x1, y1, x2, y2)] -> [(x1, (List.length y1))]
| (x1_h, y1_h, x2_h, y2_h) :: tail -> (x1_h, (List.length y1_h))::(table tail)
But the following error occured:
Error: This expression has type ('a * 'b list * 'c * 'd) list -> ('a * int) list but an expression was expected of type ('a * int) list
I'm not really sure what I did wrong there.