vault backup: 2023-09-07 15:53:49

This commit is contained in:
Louis Gallet 2023-09-07 15:53:49 +02:00
parent 63c71822b5
commit ac1facb185
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -135,14 +135,14 @@ val max2 : 'a -> 'a -> 'a = <fun>
# let min2 number1 number2 = if number1 > number2 then number2 else number1
val min2 : 'a -> 'a -> 'a = <fun>
let max3 x y z =
# let max3 x y z =
let high = if x > y then x else y in
if high > z then
high
else z;;
val max3 : 'a -> 'a -> 'a -> 'a = <fun>
let min3 x y z =
# let min3 x y z =
let low = if x < y then x else y in
if low < z then
low
@ -153,10 +153,13 @@ val min3 : 'a -> 'a -> 'a -> 'a = <fun>
x + y + z - min3 x y z - max x y z ;;
val middle3 = int -> int -> int = <fun>
let max4 number1 number2 number3 number4 =
#let max4 number1 number2 number3 number4 =
let nb1 = max2(number1 number2) and nb2 = max2(number3 number4) in max2(nb1 nb2)
let min4 number1 number2 number3 number4 = let nb1 = min2(number1 number2) and nb2 = min2(number3 number4) in min2(nb1 nb2)
# let max4 x y z t= max2(max2 x y)(max2 z t)
val max4 : 'a -> 'a -> 'a -> 'a -> 'a = <fun>
# let min4 x y z t= min2(min2 x y)(min2 z t)
```
### Exercise 3.4
```Ocaml