vault backup: 2023-09-11 16:11:15
This commit is contained in:
parent
385593088e
commit
0666f58d6f
4
.obsidian/workspace.json
vendored
4
.obsidian/workspace.json
vendored
@ -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",
|
||||
|
@ -173,29 +173,32 @@ val highest_square_sum : int -> int -> int -> int = <fun>
|
||||
## 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 = <fun>
|
||||
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 = <fun>
|
||||
|
||||
# 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 = <fun>
|
||||
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 = <fun>
|
||||
|
||||
# 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 = <fun>
|
||||
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 = <fun>
|
||||
|
||||
# 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 = <fun>
|
||||
| _ -> invalid_arg "Bad type of shipping class";;
|
||||
val rate : string -> int -> float = <fun>
|
||||
|
3
Algo/Séminaire/Weird stuff.md
Normal file
3
Algo/Séminaire/Weird stuff.md
Normal file
@ -0,0 +1,3 @@
|
||||
```Ocaml
|
||||
10 mod (-3) = 10 mod 3
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user