let rec depth tree worklist = match worklist with x::tail -> let (tr, wlist) = work tree worklist in depth tr wlist | _ -> tree