From 0a53fcf64c6f9475b7e7de590304d71133095bc7 Mon Sep 17 00:00:00 2001 From: acondolu Date: Wed, 12 Jul 2017 23:28:46 +0200 Subject: [PATCH] Fixes to printing (cherry picked from commit 4627d2b89b5a96e09b1921e033a5c1d7dd50dbc6) --- ocaml/lambda4.ml | 10 +++++----- ocaml/num.ml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ocaml/lambda4.ml b/ocaml/lambda4.ml index 369e242..2b08e72 100644 --- a/ocaml/lambda4.ml +++ b/ocaml/lambda4.ml @@ -64,11 +64,11 @@ let print_problem label ({freshno; div; conv; ps; deltas} as p) = let l = Array.to_list (Array.init (freshno + 1) string_of_var) in "measure="^string_of_measure(problem_measure p) (* ^ " freshno = " ^ string_of_int freshno*) ^ nl ^ " Discriminating sets (deltas):" - ^ nl ^ " " ^ deltas ^ (if deltas = " " then "" else nl) ^ "*)" ^ nl - ^" (* DIVERGENT *)" ^ nl - ^" "^ (match div with None -> "None" | Some div -> "(Some\""^ print ~l (div :> nf) ^"\" ") ^ nl - ^" (* CONVERGENT *) [" ^ nl - ^ String.concat "\n " (List.map (fun t -> "(* _: *) " ^ (if t = `N (-1) then "" else "\""^ print ~l (t :> nf) ^"\";")) conv) ^ + ^ nl ^ " " ^ deltas ^ (if deltas = " " then "" else nl) ^ "*)" + ^"(* DIVERGENT *)" ^ nl + ^" "^ (match div with None -> "None" | Some div -> "(Some\""^ print ~l (div :> nf) ^"\")") ^ nl + ^" (* CONVERGENT *) [" ^ nl ^ " " + ^ String.concat "\n " (List.map (fun t -> "(* _ *) " ^ (if t = `N (-1) then "" else "\""^ print ~l (t :> nf) ^"\";")) conv) ^ (if conv = [] then "" else nl) ^ "] (* NUMERIC *) [" ^ nl ^ " " ^ String.concat "\n " (List.mapi (fun i t -> " (* "^ string_of_int i ^" *) \"" ^ print ~l (t :> nf) ^ "\";") ps) diff --git a/ocaml/num.ml b/ocaml/num.ml index 4b8cd5e..5f97abb 100644 --- a/ocaml/num.ml +++ b/ocaml/num.ml @@ -119,11 +119,11 @@ let rec string_of_term l = | `I _ as t -> "(" ^ string_of_term_no_pars_app l (t :> nf) ^ ")" | `Lam _ as t -> "(" ^ string_of_term_no_pars_lam l t ^ ")" | `Match(t,(v,ar),bs_lift,bs,args) -> - "[match("^ string_of_var v ^":"^ string_of_int ar ^") " ^ string_of_term_no_pars l (t :> nf) ^ - " with " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ string_of_term l (lift bs_lift t)) !bs) ^ "] " ^ - String.concat " " (List.map (string_of_term l) args) ^ ")" - and string_of_term_no_pars_app l = function - | `I((n,ar), args) -> print_name l n ^ ":" ^ string_of_int ar ^ " " ^ String.concat " " (List.map (string_of_term_w_pars l) (Listx.to_list args)) + "["^ string_of_var v ^ (if debug_display_arities then ":"^ string_of_int ar else "") ^",match " ^ string_of_term_no_pars l (t :> nf) ^ + " with " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ string_of_term l (lift bs_lift (t :> nf))) !bs) ^ "] " ^ + String.concat " " (List.map (string_of_term l) (args :> nf list)) ^ ")" + and string_of_term_no_pars_app l = function + | `I((n,ar), args) -> print_name l n ^ (if debug_display_arities then ":" ^ string_of_int ar else "") ^ " " ^ String.concat " " (List.map (string_of_term_w_pars l) (Listx.to_list args :> nf list)) | #nf as t -> string_of_term_w_pars l t and string_of_term_no_pars_lam l = function | `Lam(_,t) -> let name = string_of_var (List.length l) in -- 2.39.2