This requires: ocaml -rectypes ---------- let st0 dmy = let st = "pusillanimous " in let l = (String.length st) - 1 in let rec s n = (st.[n], fun dum -> s (if n=l then 0 else n+1)) in s 0;; let n = 4;; type nodec = Lc of char | Nc of (nodec * nodec);; let rec bt k st = if k=0 then match (st ()) with (ch, rs) -> (Lc ch, rs) else match bt (k-1) st with (trl, sty) -> match bt (k-1) sty with (trr, stz) -> (Nc (trl, trr), stz) in bt n st0;;