Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename changed references in the OCaml stdlib #46

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions exercises/fpottier/breaking_sort/prepare.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
open Printf
(* A correct sort. *)
let sort = List.sort Pervasives.compare
let sort = List.sort Stdlib.compare

exception TODO

Expand Down Expand Up @@ -261,7 +261,7 @@ let sort42 xs =
| true, true -> 0
| true, false -> -1
| false, true -> +1
| false, false -> Pervasives.compare x y
| false, false -> Stdlib.compare x y
in
List.sort compare xs

Expand Down Expand Up @@ -299,7 +299,7 @@ let sort15 xs =
| true, true -> 0
| true, false -> -1
| false, true -> +1
| false, false -> Pervasives.compare x y
| false, false -> Stdlib.compare x y
in
List.sort compare xs

Expand Down
2 changes: 1 addition & 1 deletion exercises/fpottier/enumerating_trees/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ let compare_enumerations (type a)
end;
for s = 0 to threshold do
(* Compare sorted lists. *)
let sort = List.sort Pervasives.compare in
let sort = List.sort Stdlib.compare in
let actual = T.result (fun () -> actual () s |> Seq.elements |> sort)
and expected = Ok (expected s |> Seq.elements |> sort) in
black_box_compare (=) (wrap (print_list print))
Expand Down
2 changes: 1 addition & 1 deletion exercises/mooc/week2/seq4/ex1/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let sample_contact =
names.(id)
else names.(id mod len) ^ name (id / len) in
id := !id + len + 2 ;
let name = String.capitalize (name !id) in
let name = String.capitalize_ascii (name !id) in
let phone_number = (!id mod 23, !id mod 19, !id mod 7, !id mod 17) in
{ name ; phone_number }

Expand Down
2 changes: 1 addition & 1 deletion exercises/mooc/week4/seq1/ex1/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let sample_string_ff =
sample_cases
[ printable_fun "((^) \"@\")" ((^) "@") ;
printable_fun "(fun s -> s ^ s)" (fun s -> s ^ s) ;
printable_fun "String.uppercase" (String.uppercase) ]
printable_fun "String.uppercase_ascii" (String.uppercase_ascii) ]

let exercise_1 =
set_progress "Grading exercise 1." ;
Expand Down
6 changes: 3 additions & 3 deletions exercises/mooc/week4/seq3/ex1/prepare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ let unset r = r := 0
let ccr_reference a b c s =
s /. (2. *. (cos (a /. 2.)) *. 2. *. (cos (b /. 2.)) *. 2. *. (cos (c /. 2.)))

module Pervasives = struct
include Pervasives
module Stdlib = struct
include Stdlib
let cos_f = cos
let cos v =
set used_cos;
Expand All @@ -26,7 +26,7 @@ module Pervasives = struct
div_f x y
end

include Pervasives
include Stdlib

let test_ccr ccr (a, b, c, s) =
let unset_all () =
Expand Down
6 changes: 3 additions & 3 deletions exercises/mooc/week4/seq3/ex2/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let check_min l =
if i <= 0 then acc else
let x = Random.int 50 - 25 and y = Random.int 50 - 25 in
let v1 = result @@ fun () -> min x y in
let v2 = result @@ fun () -> Pervasives.min x y in
let v2 = result @@ fun () -> Stdlib.min x y in
compute_min min
(test [%ty: int ] v1 v2 @
[ Message ([ Text "Computing " ; Code (Format.asprintf "min %d %d" x y) ], Informative) ] @
Expand All @@ -88,9 +88,9 @@ let exercise_3 =
find_binding code_ast "my_env" @@ fun expr ->
ast_check_expr
~on_expression:(function
[%expr Pervasives.min] | [%expr min] ->
[%expr Stdlib.min] | [%expr min] ->
[ failure
~message:"You cannot use the Pervasives.min function." ]
~message:"You cannot use the Stdlib.min function." ]
| { pexp_desc = Pexp_let (_, _, _) } ->
[ failure
~message:"You cannot use any let expression to define \
Expand Down
Loading