+ let rec get_guard i = function
+ | [] -> (*assert false*) Ast.Implicit `JustOne
+ | [term, _] when i = 1 -> term
+ | _ :: tl -> get_guard (pred i) tl
+ in
+ let map (params, (id,typ), body, i) =
+ let typ =
+ match typ with
+ None -> Ast.Implicit `JustOne
+ | Some typ -> typ
+ in
+ sprintf "%s %s on %s: %s \\def %s"
+ (pp_term ~pp_parens:false term)
+ (String.concat " " (List.map (pp_capture_variable pp_term) params))
+ (pp_term ~pp_parens:false (get_guard i params))
+ (pp_term typ) (pp_term body)
+ in
+ sprintf "let %s %s in %s"