I need to make a function that takes two lazy list and an operator and applies this operator to elements of the same index on the lazy list. For example, [1; 2; 3], [2; 3; 4; 5] + will return [3; 5; 7; 5]. Lazy list is recorded as normal for readability.
Here is my code, an error occurs in it after function () ->, This expression has the type int lazyList * int lazyList * char -> int
type 'a lazyList = LNil | LCons of 'a * (unit -> 'a lazyList);; let rec ldzialanie listA listB operator = function | LCons(xA, xfA), LCons(xB, xfB), '+' -> LCons(xA + xB, function() -> ldzialanie xfA xfB '+') | LCons(xA, xfA), LCons(xB, xfB), '-' -> LCons(xA - xB, function() -> ldzialanie xfA xfB '-') | LCons(xA, xfA), LCons(xB, xfB), '/' -> LCons(xA / xB, function() -> ldzialanie xfA xfB '/') | LCons(xA, xfA), LCons(xB, xfB), '*' -> LCons(xA * xB, function() -> ldzialanie xfA xfB '*') | LNil, LNil, _ -> LNil | LNil, LCons(x, xf), _ -> LCons(x, function() -> xf()) | LCons(x, xf), LNil, _ -> LCons(x, function() -> xf()) | LCons(_), LCons(_), _ -> failwith "Not existible operator" ;;