vault backup: 2023-10-02 14:33:50
This commit is contained in:
parent
3942739253
commit
3cbc1b2470
@ -1,8 +1,19 @@
|
|||||||
## 1.1
|
## 1.1 - Product
|
||||||
```Ocaml
|
|
||||||
let product n =
|
```
|
||||||
if n = [] then
|
let rec product = function
|
||||||
|
| [] -> 0
|
||||||
|
| x::t -> x + product t;;
|
||||||
|
```
|
||||||
|
## 1.2 - Count
|
||||||
|
```
|
||||||
|
let rec count x n =
|
||||||
|
if x = [] then
|
||||||
0
|
0
|
||||||
else
|
else
|
||||||
let rec p =
|
let e::t = x
|
||||||
|
if e = x then
|
||||||
|
1 + count t n
|
||||||
|
else
|
||||||
|
count t n
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user