vault backup: 2023-09-12 17:55:20

This commit is contained in:
2023-09-12 17:55:20 +02:00
parent b63dad735f
commit 5f6aef1320
2 changed files with 9 additions and 5 deletions

View File

@ -271,6 +271,10 @@ let rec add a = function
## Exercise 4.6
```Ocaml
let rec mult a = function
| a when a = 0 | a when b = 0 -> 0
|
let rec mult a b =
if a = 0 || b = 0 then
0
else if b > 0 then
a + mult a (b - 1)
else
-mult a (-b) ;;