I am not understanding why I am getting this error: Unbound record field mid_x
when running this code. What the function midpoint_segment
is trying to do is find the midpoint of a given type segment and return a point type.
type point = {x : float; y : float} type segment = {startp : point; endp : point}let midpoint_segment {startp; endp} = let mid_x = (startp.x +. endp.x) /. 2.0 in let mid_y = (startp.y +. endp.y) /. 2.0 in {mid_x; mid_y}
What does this error mean? I am defining mid_x
and mix_y
with let
.