From 06d3ef4a3b9b885a6e402327188d8abb152055f2 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Thu, 19 Apr 2018 16:30:48 -0400 Subject: [PATCH] Leave DOT output on disk for examination --- exercises/ch01/.gitignore | 1 + exercises/ch01/Makefile | 9 ++++++--- exercises/ch01/tree.ml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/exercises/ch01/.gitignore b/exercises/ch01/.gitignore index 626a10c..c79448c 100644 --- a/exercises/ch01/.gitignore +++ b/exercises/ch01/.gitignore @@ -1,2 +1,3 @@ straight_line_program_interpreter tree +tree.dot diff --git a/exercises/ch01/Makefile b/exercises/ch01/Makefile index d376e05..2912309 100644 --- a/exercises/ch01/Makefile +++ b/exercises/ch01/Makefile @@ -21,10 +21,13 @@ build : $(EXECUTABLES) $(OCAMLC_BYTE) -c $< clean: - rm -f $(EXECUTABLES) + rm -f $(EXECUTABLES) tree.dot # There's also tree.png, but I'm keeping it. -tree.png: tree - ./tree a b c d e f g h i j k l m n o p q r s t u v foo bar kgkvbkvg lkhjlk gfjyfjf fdtrdchfhtr trhfgfch hjlilijhl iygkyugkgkhy | neato -T png > tree.png +tree.dot: tree + ./tree a b c d e f g h i j k l m n o p q r s t u v foo bar kgkvbkvg lkhjlk gfjyfjf fdtrdchfhtr trhfgfch hjlilijhl iygkyugkgkhy > tree.dot + +tree.png: tree.dot + neato -T png tree.dot > tree.png demo_unbalanced: tree.png sxiv ./tree.png diff --git a/exercises/ch01/tree.ml b/exercises/ch01/tree.ml index f150cae..195a70c 100644 --- a/exercises/ch01/tree.ml +++ b/exercises/ch01/tree.ml @@ -60,7 +60,7 @@ module BinaryTree : TREE = struct ~init:("", "\n") ~f:(fun (edges, sep) (k1, k2) -> let k1, k2 = k_to_string k1, k_to_string k2 in - (Printf.sprintf "%s%s%S -> %S;\n" edges sep k1 k2, "") + (Printf.sprintf "%s%s %S -> %S;\n" edges sep k1 k2, "") ) in "digraph G {" ^ edges ^ "}" -- 2.20.1