vault backup: 2023-09-11 23:41:53

This commit is contained in:
2023-09-11 23:41:53 +02:00
parent 206c76bd7c
commit 38f5bd8492
3 changed files with 34 additions and 5 deletions

View File

@ -1,4 +1,5 @@
## Exercise 2.2 (Power)
|## Exercise 2.2 (Power)
```Ocaml
(*First version ; 6 multiplications*)
@ -213,5 +214,23 @@ let price w (p1, p2, p3, p4) =
val price = int -> 'a * 'a * 'a * 'a -> 'a = <fun>
```
## Exercise 3.9
```Ocaml
let apm = function
| (0, 0) -> 2
| (0, y) -> 1
| (x, 0) -> 1
| (x, y) -> 0
| _ -> invalid_arg "Error";;
let strange = function
| (0, n) -> 0
| (m, 0) -> 2*m
| (m, n) -> m*n ;;
let or3 = function
| (a, false, false) -> "premier a"
| (false, b, false) -> "b"
| (false, false, c) -> "c" ;;
```