[ocaml] Avoid non-unit-statement warnings in examples

Thanks to rwmjones for the tip as to how to solve this.  See #2649
This commit is contained in:
Olly Betts 2024-02-24 08:26:57 +13:00
parent 564979a4b5
commit 9fb24e78e0
2 changed files with 3 additions and 3 deletions

View File

@ -23,13 +23,13 @@ let v = new_DoubleVector '()
let rec fill_dv v x =
if x < 0.0001 then v else
begin
v -> push_back ((x to float)) ;
ignore(v -> push_back ((x to float))) ;
fill_dv v (x *. x)
end
let _ = fill_dv v 0.999
let _ = print_DoubleVector v
let u = new_IntVector '()
let _ = for i = 1 to 4 do
u -> push_back ((i to int))
ignore(u -> push_back ((i to int)))
done
let _ = (print_float ((_average u) as float) ; print_newline ())

View File

@ -7,7 +7,7 @@ let v = new_StringVector '()
let _ =
for i = 0 to (Array.length Sys.argv) - 1 do
let str = (Sys.argv.(i)) to string in v -> push_back (str)
let str = (Sys.argv.(i)) to string in ignore(v -> push_back (str))
done
let _ = _vec_write '(v)