From 1b2f56f348988e831d79c576c879e1534beb4965 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 11 Sep 2023 16:46:12 +0200 Subject: [PATCH] vault backup: 2023-09-11 16:46:12 --- Algo/Séminaire/Chapter 3 - Case analysis.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Algo/Séminaire/Chapter 3 - Case analysis.md b/Algo/Séminaire/Chapter 3 - Case analysis.md index 2aa4738..3f49d9a 100644 --- a/Algo/Séminaire/Chapter 3 - Case analysis.md +++ b/Algo/Séminaire/Chapter 3 - Case analysis.md @@ -149,3 +149,16 @@ val avg : int -> int -> int = ``` > 💭 We read that like "let avg the function that to a associate the function that to b associate a+b divided by two" +**For the match function** +```Ocaml +# let f x = watch x with + | 0 -> 18 + | 1 -> 24 + | _ -> x*x ;; +# let f = function + | 0 -> 18 + | 1 -> 24 + | _ -> x * x;; +``` + +### Filtering several values