lec 05 notes

This commit is contained in:
SowinskiBraeden committed 2026-02-05 11:37:06 -08:00
1 parent 9d6617daee
commit 2da8e0df6c
10 files changed
+249

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
(* 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()
(* cat() *)
(**** build and test ****)
(*
ocamlbuild cat.native
./cat.native < filename
*)