vault backup: 2023-09-14 16:20:59
This commit is contained in:
parent
371f88ff5b
commit
10c9f6b716
15
.obsidian/workspace.json
vendored
15
.obsidian/workspace.json
vendored
@ -13,7 +13,7 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||
"file": "Algo/Séminaire/Chapter 5 - Recursivity.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
@ -85,7 +85,7 @@
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||
"file": "Algo/Séminaire/Chapter 5 - Recursivity.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
@ -102,7 +102,7 @@
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||
"file": "Algo/Séminaire/Chapter 5 - Recursivity.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
@ -125,7 +125,7 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md"
|
||||
"file": "Algo/Séminaire/Chapter 5 - Recursivity.md"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -158,11 +158,11 @@
|
||||
},
|
||||
"active": "9e7be1904dfd4451",
|
||||
"lastOpenFiles": [
|
||||
"Algo/Séminaire/assets/unitaire-meme.png",
|
||||
"Algo/Séminaire/Chapter 5 - Recursivity.md",
|
||||
"Algo/Séminaire/Exercices seminaire.md",
|
||||
"Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||
"Algo/Séminaire/Chapter 5 - Recursivity.md",
|
||||
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"Algo/Séminaire/assets/unitaire-meme.png",
|
||||
"Algo/Séminaire/Exercices seminaire.md",
|
||||
"Algo/Séminaire/Introduction.md",
|
||||
"Algo/Séminaire/Chapter 2 - Functions.md",
|
||||
"Algo/Séminaire/assets/fact function response.png",
|
||||
@ -185,7 +185,6 @@
|
||||
"Mathématiques/Séminaire/Logics",
|
||||
"Mathématiques/Séminaire/Logics/Pasted image 20230904101721.png",
|
||||
"Mathématiques/Séminaire/Logics/Pasted image 20230904101453.png",
|
||||
"Mathématiques/Séminaire/Logics/Pasted image 20230904100934.png",
|
||||
"Mathématiques/Séminaire",
|
||||
"2023-09-01.md",
|
||||
"Algo",
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||

|
||||
## 0.1. Print
|
||||
If we want to print something in CAML, we have to use this structure
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||

|
||||
|
||||
<center><img src="https://gitea.louisgallet.fr/lgallet/epicours/raw/branch/main/Algo/S%C3%A9minaire/assets/recursivite-meme.png " width=512 height=auto /> </center>
|
||||
|
||||
### 5.1. Simple functions
|
||||
To create a recursive function we have to use this structure
|
||||
@ -64,3 +65,29 @@ A[ctd 3] --> B[ctd 2] --> C[ctd 1] --> D[ctd 0] --> E[ctd -1] --> F[ ] --> E -->
|
||||
> ctd is countdown
|
||||
|
||||
## 5.3. Several recursive calls
|
||||
A function that have several recursive calls is defind like this
|
||||
$$
|
||||
Fn = {1 -> \text{if } n\eqslantless{1} \brace{Fn+1+Fn+2} }
|
||||
$$
|
||||
**Fibonacci functions**
|
||||
```Ocaml
|
||||
let rec fibonacci n =
|
||||
if n = 0 then
|
||||
0
|
||||
else if n = 1 then
|
||||
1
|
||||
else
|
||||
fibonacci(n-1) + fibonacci(n-2);;
|
||||
|
||||
let add n =
|
||||
if n = 0 then
|
||||
false
|
||||
else
|
||||
even (n-1);;
|
||||
|
||||
let even n =
|
||||
if n = 0 then
|
||||
true
|
||||
else
|
||||
add (n-1);;
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user