vault backup: 2023-09-07 21:25:19
This commit is contained in:
parent
a61d373d4c
commit
1e0b99b364
14
.obsidian/workspace.json
vendored
14
.obsidian/workspace.json
vendored
@ -13,7 +13,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
@ -102,7 +102,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md"
|
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,11 +148,11 @@
|
|||||||
},
|
},
|
||||||
"active": "bdba25946b821d06",
|
"active": "bdba25946b821d06",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Algo/Séminaire/Exercices seminaire.md",
|
|
||||||
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
|
||||||
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
|
||||||
"Algo/Séminaire/Chapter 2 - Functions.md",
|
"Algo/Séminaire/Chapter 2 - Functions.md",
|
||||||
"Algo/Séminaire/Introduction.md",
|
"Algo/Séminaire/Introduction.md",
|
||||||
|
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||||
|
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||||
|
"Algo/Séminaire/Exercices seminaire.md",
|
||||||
"Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg",
|
"Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg",
|
||||||
"Algo/Séminaire/assets",
|
"Algo/Séminaire/assets",
|
||||||
"Algo/Séminaire/assets/F1D2AA19-E790-4022-AFFF-F778EAB28AB5.jpg",
|
"Algo/Séminaire/assets/F1D2AA19-E790-4022-AFFF-F778EAB28AB5.jpg",
|
||||||
|
@ -95,7 +95,37 @@ val f : int -> int = <fun>
|
|||||||
```Ocaml
|
```Ocaml
|
||||||
# let and_ a b =
|
# let and_ a b =
|
||||||
match a with
|
match a with
|
||||||
true -> match b with
|
true -> (match b with
|
||||||
true -> true
|
true -> true
|
||||||
| false -> false
|
| false -> false)
|
||||||
| false -> false;;
|
| false -> false;;
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ If you forgot the parentheses, Caml will belived the two `|false` belong to the same pattern matching
|
||||||
|
|
||||||
|
### Universal pattern
|
||||||
|
```Ocaml
|
||||||
|
# let f x = match x with
|
||||||
|
0 -> 18
|
||||||
|
| 1 -> 24
|
||||||
|
| _ -> x*x ;;
|
||||||
|
```
|
||||||
|
|
||||||
|
### "Or" filter
|
||||||
|
```Ocaml
|
||||||
|
let f x match x with
|
||||||
|
0 | 20 -> 18
|
||||||
|
| 1 | 11 | 12 -> 24
|
||||||
|
|_ -> x * x ;;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Guarded filters
|
||||||
|
```Ocaml
|
||||||
|
let sign x = match x with
|
||||||
|
0 -> 0
|
||||||
|
| y when y < 0 -> -1
|
||||||
|
| _ -> 1
|
||||||
|
```
|
||||||
|
|
||||||
|
> `y when y<0` is an evaluation
|
||||||
|
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
- The goal is to take an input and give an output with the solution
|
- The goal is to take an input and give an output with the solution
|
||||||
|
|
||||||
## How to write an algorithm
|
## How to write an algorithm
|
||||||
1) What :
|
1) What do you have available ; What is the output that your searching for => this is call specifications
|
||||||
- What do you have available ; What is the output that your searching for => this is call specifications
|
2) How : find resolution methods and choose the best one
|
||||||
- How : find resolution methods and choose the best one
|
3) Formalism : shape it like a computer talk
|
||||||
- Formalism : shape it like a computer talk
|
4) Translate :
|
||||||
- Translate :
|
|
||||||
|
|
||||||
## Compilation and interpretation
|
## Compilation and interpretation
|
||||||
### Compiler
|
### Compiler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user