restructure + lecutre 07
This commit is contained in:
96 files changed
+458
-4
No files matched your search
@@ -0,0 +1,25 @@
|
||||
(* display content of file read via stdin *)
|
||||
let rec cat () =
|
||||
try
|
||||
let line = read_line () in
|
||||
print_endline line;
|
||||
cat()
|
||||
with
|
||||
| _ -> ();; (* EOF return unit *)
|
||||
|
||||
(* similar to main function *)
|
||||
let () =
|
||||
let rec aux () =
|
||||
try
|
||||
print_endline @@ read_line ();
|
||||
aux ()
|
||||
with
|
||||
| _ -> ()
|
||||
in
|
||||
aux()
|
||||
|
||||
(**** build and test ****)
|
||||
(*
|
||||
ocamlbuild cat.native
|
||||
./cat.native < filename
|
||||
*)
|
||||
Reference in new issue
Block a user