From ec8c78cf4e5950bcbbb5edea27db2a4b7a797579 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 11 Oct 2023 11:23:46 +0200 Subject: [PATCH] vault backup: 2023-10-11 11:23:46 --- .obsidian/workspace.json | 10 +++++----- Algo/CM/CM du 11 octobre.md | 2 -- Algo/CM/Lists.md | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) delete mode 100644 Algo/CM/CM du 11 octobre.md create mode 100644 Algo/CM/Lists.md diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 9ee5b82..e991bcc 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -25,7 +25,7 @@ "state": { "type": "markdown", "state": { - "file": "Algo/CM/CM du 11 octobre.md", + "file": "Algo/CM/Lists.md", "mode": "source", "source": false } @@ -98,7 +98,7 @@ "state": { "type": "backlink", "state": { - "file": "Algo/CM/CM du 11 octobre.md", + "file": "Algo/CM/Lists.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -115,7 +115,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "Algo/CM/CM du 11 octobre.md", + "file": "Algo/CM/Lists.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -138,7 +138,7 @@ "state": { "type": "outline", "state": { - "file": "Algo/CM/CM du 11 octobre.md" + "file": "Algo/CM/Lists.md" } } }, @@ -172,7 +172,7 @@ "active": "26919eaeae9a8f38", "lastOpenFiles": [ "Algo/CM/CM du 27 septembre.md", - "Algo/CM/CM du 11 octobre.md", + "Algo/CM/Lists.md", "Algo/CM/CM du 04 octobre.md", "Algo/Courses/Chapter 6 - Lists (Exercises).md", "Algo/Courses/Chapter 6 - Lists.md", diff --git a/Algo/CM/CM du 11 octobre.md b/Algo/CM/CM du 11 octobre.md deleted file mode 100644 index a4469e9..0000000 --- a/Algo/CM/CM du 11 octobre.md +++ /dev/null @@ -1,2 +0,0 @@ -List is the most fundamental data type. Is a sequencial argument, is a final sequence of element. It is no possible to have more than one element per box. -There is two different way to declare a list, the recursive one and the iterative one. diff --git a/Algo/CM/Lists.md b/Algo/CM/Lists.md new file mode 100644 index 0000000..37ce20f --- /dev/null +++ b/Algo/CM/Lists.md @@ -0,0 +1,38 @@ +List is the most fundamental data type. Is a sequencial argument, is a final sequence of element. It is no possible to have more than one element per box. +There is two different way to declare a list, the recursive one and the iterative one. + +## Recursive list +- The first box is the **head of the list** +- The rest of the list is **the tail of the list** +- The signature of the recursive list is the following: +``` +TYPES + list, box + +USES + element + +OPERATIONS + emptylist : -> list (* Internal operations of list*) + cons : list x element -> list (* Internal operations of list *) + tail : list -> list (* Internal operations of list *) + head : list -> box (* Internal operations of box *) + contents : box -> element (* Observer of box *) + first : list -> element (* Observer of list *) + next : box -> box (* Internal operation of box *) + +PRECONDITIONS + tail(_l_) is-defined-iaoi _l_ ≠ emptylist + head(_l_) is-defined-iaoi _l_ ≠ emptylist + first(_l_) is-defined-iaoi _l_ ≠ emptylist + +AXIOMS + first(_l_) = contents(head(_l_)) + tail(cons(_e,l_)) = _l_ + first(cons(_e,l_)) = _e_ + next(head(_l_)) = head(tail(_l_)) + +WITH + list _l_ + element _e_ +```