Hi I am trying to do this exercise but can’t quite figure it out. I am given the following code in F#
type A<’a> = | D of ’a * bool
| E of A<’a> * A<’a>
let rec g acc x = match x with
| E(y,z) -> g (g acc z) y
| D(a,true) -> a::acc
| _ -> acc;;
let h x = g [] x;;
The exercise is now to argue if g is a tail-recursive function or not and to provide declarations of continuation-based, tail-recursive variants of both g and h. Hope someone can help!