vault backup: 2023-10-02 14:33:50
This commit is contained in:
parent
3942739253
commit
3cbc1b2470
@ -1,8 +1,19 @@
|
||||
## 1.1
|
||||
```Ocaml
|
||||
let product n =
|
||||
if n = [] then
|
||||
## 1.1 - Product
|
||||
|
||||
```
|
||||
let rec product = function
|
||||
| [] -> 0
|
||||
| x::t -> x + product t;;
|
||||
```
|
||||
## 1.2 - Count
|
||||
```
|
||||
let rec count x n =
|
||||
if x = [] then
|
||||
0
|
||||
else
|
||||
let rec p =
|
||||
|
||||
else
|
||||
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