My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-ocm: defer file I/O via report function

The README example called [Ocm.of_file "satellite.ocm"] at top level,
so mdx execution failed with [Sys_error: No such file or directory].
Wrap as [let report path = ...] so the snippet typechecks without
hitting the filesystem, and switch [Printf.printf] to [Fmt.pr] for
consistency.

+11 -9
+11 -9
ocaml-ocm/README.md
··· 26 26 ## Usage 27 27 28 28 ```ocaml 29 - match Ocm.of_file "satellite.ocm" with 30 - | Ok ocm -> 31 - Printf.printf "Object: %s (%s)\n" 32 - (Ocm.object_name ocm) (Ocm.object_designator ocm); 33 - List.iter (fun traj -> 34 - Printf.printf "Trajectory %s: %d points\n" 35 - traj.Ocm.traj_id (Array.length traj.data) 36 - ) ocm.trajectories 37 - | Error e -> Fmt.epr "%a\n" Ocm.pp_error e 29 + let report path = 30 + match Ocm.of_file path with 31 + | Ok ocm -> 32 + Fmt.pr "Object: %s (%s)@." (Ocm.object_name ocm) 33 + (Ocm.object_designator ocm); 34 + List.iter 35 + (fun traj -> 36 + Fmt.pr "Trajectory %s: %d points@." traj.Ocm.traj_id 37 + (Array.length traj.data)) 38 + ocm.trajectories 39 + | Error e -> Fmt.epr "%a@." Ocm.pp_error e 38 40 ``` 39 41 40 42 ## API Overview