Skip to content

Commit 3301486

Browse files
ClémentClément
authored andcommitted
Restoring web-order makefile rule.
1 parent b293318 commit 3301486

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

source/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ $(EXO_DIR)%.md: $(SOL_DIR)%.md
422422
# This is work in progress and need to be updated.
423423
$(BUILD_DIR)web-order.ts: order
424424
@mkdir -p $(dir $@)
425-
@echo -n "// This file was generated automatically by calling make web-order.ts.\n// Refer to the Makefile to read indications on how to generate and edit it.\nexport const nameOrderMap: Record<string, number> = {\n" > $@ @n=0 ;
425+
@echo -n "// This file was generated automatically by calling make web-order.ts.\n// Refer to the Makefile to read indications on how to generate and edit it.\nexport const nameOrderMap: Record<string, number> = {\n" > $@
426+
@n=0 ;
426427
@while read -r line; do \
427428
n=$$((n+1)); \
428429
echo -n '\t"' >> $@;\

source/lectures/data/intro.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,56 @@ tags:
55

66
# Introduction
77

8-
An [abstract data type (ADT)](https://en.wikipedia.org/wiki/Abstract_data_type) is a mathematical model for data types, typically giving
8+
Let us begin by explaining the differences between *data types*, *abstract data types* and *data structures*.
9+
10+
## Data Types
11+
12+
[*Data types*](https://en.wikipedia.org/wiki/Data_type) are the most basic classification of data, usually given as
13+
14+
- a set of possible values,
15+
- a set of allowed operations on them,
16+
- a concrete representation for computer to manipulate.
17+
18+
An examples is `int` with its [arithmetic operators](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/arithmetic-operators), represented using 32 bits with the [`Int32 Struct`](https://learn.microsoft.com/en-us/dotnet/api/system.int32?view=net-9.0).
19+
20+
## Abstract Data Types
21+
22+
An [*abstract data type* (ADT)](https://en.wikipedia.org/wiki/Abstract_data_type) is a mathematical model for data types, typically giving
923

1024
- possible values,
1125
- possible operations on data of this type,
1226
- behavior of those operations.
1327

14-
Data *structures*, on the other hand, are concrete representations of data, from the point of view of a programmer, and not from a user's perspective.
28+
They are very close to data types, with the following exceptions:
29+
30+
- They exist only conceptually, they have no concrete existence in the context of a language,
31+
- They define the "contractual agreement" regarding their behavior.
32+
33+
An example is the notion of ["sets"](https://en.wikipedia.org/wiki/Set_(abstract_data_type)), given as a universe, a union operation that returns the union of its elements, a subset predicates that returns "true" if the first argument is a subset of the second, etc.
34+
35+
## Data Structures
36+
37+
[*Data structures*](https://en.wikipedia.org/wiki/Data_structure) are concrete representations of data (comprised of multiple values), from the point of view of a programmer, and not from a user's perspective.
38+
It is in general given by
39+
40+
- data values,
41+
- the relationships among them,
42+
- the functions or operations that can be applied to the data.
43+
44+
They are generally useful for storing and retrieving data, that is, collection of values.
45+
46+
## Summarizing
1547

48+
- An abstract data type is the "description", the interface, the contract: this is the most abstract perspective, describing the *behavior* of the structure you want to manipulate.
49+
- A data type is the implementation of an abstract data type, giving concrete instructions to the computer for how to manipulate it.
50+
- A data structure is a concrete implementation of how to
1651

52+
Some abstract data types are implemented as data types: integers [can be given as an abstract data type](https://cs.stackexchange.com/questions/153597/are-integers-an-abstract-data-type) and are (imperfectly) implemented in C# as `int`^[Typically, `int` cannot correctly add 2,147,483,647 (the value of `int.MaxValue`) and 2, making it an imperfect implementation of integers.]
53+
Some abstract data types are (imperfectly) implemented as data structures, for example strings of text are implemented in the [`String` class](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-9.0).
1754

1855
## Arrays
1956

20-
Arrays are structures that allow you to store multiple values in memory using a single name and indexes.
57+
Arrays are data structures that allow you to store multiple values in memory using a single name and indexes.
2158
Internally, an array contains a fixed number of variables (called *elements*) of a particular type^[Usually, all the elements of an array have the same type, but an array can store elements of different types if `object` is its type, since any element is actually of type `object`.].
2259
The elements in an array are always stored in a contiguous block of memory, providing fast and efficient access.
2360

0 commit comments

Comments
 (0)