From 65fd6fdd0204a051b22fc49d8f38c65c7aa902ac Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 30 Oct 2023 11:04:57 +0100 Subject: [PATCH] vault backup: 2023-10-30 11:04:57 --- .obsidian/workspace.json | 2 +- Exam.md | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 9ac8a05..dee5090 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -157,7 +157,7 @@ "command-palette:Open command palette": false } }, - "active": "ab0d8956c63542fc", + "active": "c473a791e2b34194", "lastOpenFiles": [ "Exam.md", "Algo/Courses/Chapter 6 - Lists.md", diff --git a/Exam.md b/Exam.md index 6229f37..68f1b99 100644 --- a/Exam.md +++ b/Exam.md @@ -1,8 +1,14 @@ ## Multiple insertion ``` -# let split sep = function - | [] -> [] - | e::t -> - let aux +# let rec split sep lst = + let rec aux acc current = function + | [], [] -> acc + | [], tail -> current :: acc + | x::xs, _ -> + if sep x then + aux (current::acc) [] (xs, []) + else aux acc (x :: current) (xs, current) + in aux [] [] (lst, []) +val split: ('a -> bool) -> 'a list -> 'a list list = ```