From 567169dd7b56da4b2eccf193b313618161aafedd Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 10 Apr 2018 12:23:09 -0700 Subject: [PATCH] adsep: some lunch progress --- adsep/chapter01/notes.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/adsep/chapter01/notes.md b/adsep/chapter01/notes.md index 013cfb7..b503cfb 100644 --- a/adsep/chapter01/notes.md +++ b/adsep/chapter01/notes.md @@ -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*