adsep: some lunch progress
This commit is contained in:
parent
b7193a9e96
commit
567169dd7b
|
@ -25,4 +25,43 @@
|
|||
by the programmer
|
||||
+ *cardinality*: the number of distinct values belonging to some type
|
||||
*T*
|
||||
+ *methods of structuring*:
|
||||
+ the array
|
||||
+ the record (aka structure)
|
||||
+ the set
|
||||
+ the sequence (aka file)
|
||||
+ operators provide a mechanism for using data
|
||||
+ comparison and assignment: most important basic operators
|
||||
+ assignment: `:=`
|
||||
+ equality: `=`
|
||||
+ *transfer operator*: translate between data types
|
||||
+ *selector* instead of *getter*
|
||||
|
||||
## Primitive data types
|
||||
|
||||
+ enum: integer used when the data type type represents a choice from
|
||||
a small set of choices
|
||||
+ rule 1.1: **type** *T* = (*c*_1, *c*_2, …, *c*_n)
|
||||
+ cardinality of T: card(T) ← *n*
|
||||
+ ordered types define *succ(x)* and *pred(x)*
|
||||
+ ordering among values of *T* is defined by rule 1.2: (*c*_i < *c*_j) = (*i* < *j*)
|
||||
|
||||
## Standard primitive types
|
||||
|
||||
+ four types: integer, Boolean, char, real
|
||||
+ integers
|
||||
+ subset of whole numbers depending on implementation (e.g. 32-bit v. 64-bit)
|
||||
+ four basic operations: +, -, *, **div**
|
||||
+ integer division returns an integer result, e.g. for positive *m* and *n*
|
||||
+ rule 1.3: *m* - *n* < (*m* **div** *n*) * *n* <= *m*
|
||||
+ modulus operator is defined by
|
||||
+ rule 1.4: (*m* **div** *n*) * *n* + (*m* **mod** *n*) = *m*
|
||||
+ real
|
||||
+ limitations on precision due to implementation
|
||||
+ real division: **/**
|
||||
+ Boolean
|
||||
+ operators: **and**, **or**, **not**
|
||||
+ comparisons are operators yielding a Boolean
|
||||
+ char
|
||||
+ printable character
|
||||
+ standard char ←→ integer transfer functions: *ord* and *chr*
|
||||
|
|
Loading…
Reference in New Issue