[OCaml] Fix some of the OCaml examples
Update some of the OCaml examples so that they run successfully with `make check-ocaml-examples` (important for the CI). Some of the examples were written to depend on passed arguments. Temporarily disable the broken std_string example.
This commit is contained in:
parent
539d145b96
commit
1be9f5fec3
5 changed files with 12 additions and 14 deletions
|
|
@ -5,17 +5,8 @@ open Example
|
|||
|
||||
exception BadReturn
|
||||
|
||||
let _ = if Array.length Sys.argv < 3 then
|
||||
begin
|
||||
print_endline
|
||||
("Usage: " ^ Sys.argv.(0) ^ " n1 n2\n" ^
|
||||
" Displays the least factors of the numbers that have the same\n" ^
|
||||
" relationship, 16 12 -> 4 3\n") ;
|
||||
exit 0
|
||||
end
|
||||
|
||||
let x = int_of_string Sys.argv.(1)
|
||||
let y = int_of_string Sys.argv.(2)
|
||||
let x = if Array.length Sys.argv > 1 then int_of_string Sys.argv.(1) else 16
|
||||
let y = if Array.length Sys.argv > 2 then int_of_string Sys.argv.(2) else 12
|
||||
let (xf,yf) = match _factor '((x to int),(y to int)) with
|
||||
C_list [ C_int a ; C_int b ] -> a,b
|
||||
| _ -> raise BadReturn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue