restructure + lecutre 07

This commit is contained in:
SowinskiBraeden committed 2026-02-19 11:59:58 -08:00
1 parent b8c19aa341
commit 7c3198fee4
96 files changed
+458 -4

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
let rec number acc ic =
try
Printf.printf "%5d| %s\n" acc @@ input_line ic;
number (acc + 1) ic
with
| _ -> if ic <> stdin then close_in ic else ()
let () =
if Array.length Sys.argv = 1 then
number 1 stdin
else
try
number 1 @@ open_in Sys.argv.(1)
with
| Sys_error s -> Printf.eprintf "%s\n" s;;