vault backup: 2023-09-12 16:35:48

This commit is contained in:
2023-09-12 16:35:48 +02:00
parent e500ac3dac
commit 75bdb42cd6
3 changed files with 40 additions and 8 deletions

View File

@ -53,4 +53,12 @@ val countdown = int -> unit = ()
3
2
1
- : unit = ()
- : unit = ()
```
Flowchart of CAML evaluation
```mermaid
flowchart LR
A[ctd 3] --> B[ctd 2] --> C[ctd 1] --> D[ctd 0] --> E[ctd -1] --> F[ ] --> E --> D --> C --> B --> A
```
> ctd is countdown

View File

@ -247,3 +247,16 @@ val or3-simple: bool*bool*bool -> bool = <fun>
```Ocaml
let time_difference (d1, md1, sd1, pos1) (d2, md2, sd2, pos2)
```
## Exercise 4.2
```Ocaml
let rec suite n = let a = 0 in
if n <= 0 then
a
else
a + suite (4*(n-1) - 1);;
let rec sequence = function
| 0 -> 1
| n -> 4* sequence(n-1) - 1;;