# HG changeset patch # User Michael O'Neill # Date 1348192627 14400 # Node ID a5b763b602c94c68d7a54c856206019f50e38225 # Parent 196d261eeef3433cd8c0c70b84c8bfec8f3e280b Better output for splitter.ml. Add the input file for splitter.ml. Try to play nice with Bitbucket's Markdown parser. diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -38,10 +38,10 @@ per-line. Read in the integers, sort them and print them out in sorted order (on a single line). Name your program _splitter.ml_. - The basic steps in the algorithm are: - - Read input into a list. - - Print the input list. - - Call a function, splitter, which takes the input list and splits it into two lists. One list will contain all of the even numbers from the input file and the other contains all of the odd numbers. + The basic steps in the algorithm are: + - Read input into a list. + - Print the input list. + - Call a function, splitter, which takes the input list and splits it into two lists. One list will contain all of the even numbers from the input file and the other contains all of the odd numbers. - Print out both the even and odd lists. This program can be implemented without using any assignment statements. diff --git a/input.dat b/input.dat new file mode 100644 --- /dev/null +++ b/input.dat @@ -0,0 +1,16 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 diff --git a/splitter.ml b/splitter.ml --- a/splitter.ml +++ b/splitter.ml @@ -17,6 +17,6 @@ let ilist = fr ic [] in let e,o = splitter ilist [] [] in -print_endline (String.concat " " (List.map string_of_int ilist)); -print_endline (String.concat " " (List.map string_of_int e)); -print_endline (String.concat " " (List.map string_of_int o)) +print_endline ("Input: " ^ String.concat " " (List.map string_of_int ilist)); +print_endline ("Evens: " ^ String.concat " " (List.map string_of_int e)); +print_endline (" Odds: " ^ String.concat " " (List.map string_of_int o))