From 0666f58d6f716f7c9a963fb6fa5be63634c275d5 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 11 Sep 2023 16:11:15 +0200 Subject: [PATCH] vault backup: 2023-09-11 16:11:15 --- .obsidian/workspace.json | 4 ++- Algo/Séminaire/Exercices seminaire.md | 37 +++++++++++++++------------ Algo/Séminaire/Weird stuff.md | 3 +++ 3 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 Algo/Séminaire/Weird stuff.md diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index f32b144..7c9d8bc 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -148,10 +148,12 @@ }, "active": "26ca4bd66426e29b", "lastOpenFiles": [ + "Algo/Séminaire/Weird stuff.md", "Algo/Séminaire/Chapter 3 - Case analysis.md", + "Untitled", "Algo/Séminaire/Exercices seminaire.md", - "Algo/Séminaire/Chapter 2 - Functions.md", "Algo/Séminaire/Chapter 1 - CAML basics.md", + "Algo/Séminaire/Chapter 2 - Functions.md", "Algo/Séminaire/Introduction.md", "Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg", "Algo/Séminaire/assets", diff --git a/Algo/Séminaire/Exercices seminaire.md b/Algo/Séminaire/Exercices seminaire.md index 6ed0948..8943a57 100644 --- a/Algo/Séminaire/Exercices seminaire.md +++ b/Algo/Séminaire/Exercices seminaire.md @@ -173,29 +173,32 @@ val highest_square_sum : int -> int -> int -> int = ## Exercise 3.7 ```Ocaml # let rate_eco kg = match kg with - x when x <= 500. -> 3.40 - | x when x <=1000. -> 4.60 - | x when x <= 2000. -> 5.10 - | x when x <= 3000. -> 6.90 ;; -val rate_eco : float -> float = + x when x <= 500 -> 3.40 + | x when x <=1000 -> 4.60 + | x when x <= 2000 -> 5.10 + | x when x <= 3000 -> 6.90 + | _ -> invalid_arg "Cannot be more than 3000g";; +val rate_eco : int -> float = # let rate_standard kg = match kg with - x when x <= 500. -> 4.60 - | x when x <=1000. -> 5.90 - | x when x <= 2000. -> 6.50 - | x when x <= 3000. -> 7.20;; -val rate_standart : float -> float = + x when x <= 500 -> 4.60 + | x when x <=1000 -> 5.90 + | x when x <= 2000 -> 6.50 + | x when x <= 3000 -> 7.20 + | _ -> invalid_arg "Cannot be more than 3000g";; +val rate_standart : int -> float = # let rate_express kg = match kg with - x when x <= 500. -> 9.10 - | x when x <=1000. -> 11. - | x when x <= 2000. -> 13.5 - | x when x <= 3000. -> 14.2;; -val rate_express : float -> float = + x when x <= 500 -> 9.10 + | x when x <=1000 -> 11. + | x when x <= 2000 -> 13.5 + | x when x <= 3000 -> 14.2; + | _ -> invalid_arg "Cannot be more than 3000g";; +val rate_express : int -> float = # let rate rt kg = match rt with x when x = "economic" -> rate_eco(kg) | x when x = "standard" -> rate_standard(kg) | x when x = "express" -> rate_express(kg) - | _ -> invalid_arg "Bad type of shipping class" -val rate : string -> float -> float = + | _ -> invalid_arg "Bad type of shipping class";; +val rate : string -> int -> float = diff --git a/Algo/Séminaire/Weird stuff.md b/Algo/Séminaire/Weird stuff.md new file mode 100644 index 0000000..c7ce9d0 --- /dev/null +++ b/Algo/Séminaire/Weird stuff.md @@ -0,0 +1,3 @@ +```Ocaml +10 mod (-3) = 10 mod 3 +```