diff --git a/examples/lambda.ml b/examples/lambda.ml index 2111cb86..b925f5fc 100644 --- a/examples/lambda.ml +++ b/examples/lambda.ml @@ -84,13 +84,12 @@ let _choose_var ~vars = match vars with List.nth vars i let rec _random_term fuel vars = - match Random.int 3 with + match Random.int 2 with | _ when fuel = 1 -> _choose_var ~vars - | 0 -> _choose_var ~vars - | 1 -> + | 0 -> let f1,f2 = _split_fuel fuel in App (_random_term f1 vars, _random_term f2 vars) - | 2 -> + | 1 -> let v = _random_var () in Lambda (v, _random_term (fuel-1) (Var v::vars)) | _ -> assert false @@ -110,5 +109,5 @@ let print_reduction t = let () = Random.self_init (); - let t = _random_term (15 + Random.int 30) [] in + let t = _random_term (5 + Random.int 20) [] in PrintBox.output ~indent:2 stdout (print_reduction t) diff --git a/misc/printBox.ml b/misc/printBox.ml index fdaf5547..de703a11 100644 --- a/misc/printBox.ml +++ b/misc/printBox.ml @@ -258,8 +258,8 @@ module Box = struct | Tree (indent, node, children) -> let dim_children = _dim_vertical_array children in let s = size node in - { x=max s.x (dim_children.x+2+indent) - ; y=s.y + dim_children.y + (Array.length children-1) + { x=max s.x (dim_children.x+3+indent) + ; y=s.y + dim_children.y } let _make shape = @@ -434,14 +434,13 @@ let rec _render ?(offset=origin) ?expected_size ~out b pos = assert (Array.length a > 0); let _ = Box._array_foldi (fun pos' i b -> - Output.put_string out pos' "+ "; + Output.put_string out pos' "+- "; if i