diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index ecbd182..793e98f 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -202,7 +202,8 @@ "triangle-inequality.png", "triangle-inequality-degenerate.png", "adj-list-representation.png", - "adj-matrix-representation.png" + "adj-matrix-representation.png", + "church-rosser.png" ], "File Hashes": { "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", @@ -315,9 +316,9 @@ "_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd", "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", "c17/strings.md": "2da50edd26eae35c81f70e65bbd12d49", - "c17/index.md": "2139482226954123756e45c2190ec4a8", + "c17/index.md": "b039549b80bde34fab31b61b5e28e9d4", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", - "c17/declarations.md": "98c5a92433eeaece6d77450fbc5752ed", + "c17/declarations.md": "2d7877915bf8a2772d1e4de636ba52a5", "algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd", "_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4", "_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7", @@ -382,7 +383,7 @@ "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", - "set/index.md": "91060cf5e604f7683a34710dda2ea10b", + "set/index.md": "fd887b45cf0d884c841d0ce651ddf513", "set/graphs.md": "15aa43bf7f73347219f822e4b400e9bf", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03/2024-03-18.md": "2c711c50247a9880f7ed0d33b16e1101", @@ -509,7 +510,7 @@ "set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7", "_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5", "_journal/2024-05/2024-05-13.md": "d549dd75fb42b4280d4914781edb0113", - "x86-64/registers.md": "5cb49ae47fb0f95df6e15991274f4ad3", + "x86-64/registers.md": "5f1c601930681df39a0b24b55fa4c593", "_journal/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908", "_journal/2024-05/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5", "_journal/2024-05-16.md": "580c7ec61ec56be92fa8d6affcf0a5f6", @@ -544,7 +545,7 @@ "_journal/2024-05-27.md": "b36636d10eab34380f17f288868df3ae", "_journal/2024-05/2024-05-26.md": "abe84b5beae74baa25501c818e64fc95", "algebra/set.md": "a89ada021de83240724adb70490e3472", - "algebra/boolean.md": "fc47edb7d0080b73ce1ce0d3e0e16d7d", + "algebra/boolean.md": "c9bd5abb601be6d2bedd24d5f54848b0", "git/merge-conflicts.md": "761ad6137ec51d3877f7d5b3615ca5cb", "_journal/2024-05-28.md": "0f6aeb5ec126560acdc2d8c5c6570337", "_journal/2024-05/2024-05-27.md": "e498d5154558ebcf7261302403ea8016", @@ -597,7 +598,7 @@ "set/functions.md": "6716f8a32af73e5a4d1b2cbf6987b60f", "_journal/2024-06-15.md": "92cb8dc5c98e10832fb70c0e3ab3cec4", "_journal/2024-06/2024-06-14.md": "5d12bc272238ac985a1d35d3d63ea307", - "lambda-calculus/beta-reduction.md": "2074de1a5ab2171489239988a84b271f", + "lambda-calculus/beta-reduction.md": "a8e2825c84e842ceef7aa638a493b91a", "_journal/2024-06-16.md": "ded6ab660ecc7c3dce3afd2e88e5a725", "_journal/2024-06/2024-06-15.md": "c3a55549da9dfc2770bfcf403bf5b30b", "_journal/2024-06-17.md": "63df6757bb3384e45093bf2b9456ffac", @@ -641,7 +642,7 @@ "_journal/2024-07/2024-07-03.md": "55d4b1e159b41c6dd52943e5b7a50961", "_journal/2024-07/2024-07-02.md": "489464ee47c3ba21307bfabae569ad29", "_journal/2024-07/2024-07-01.md": "7cffc27813fe7a7338e411d054ac3bd5", - "set/bags.md": "ba7990801734f411838d7b33e7ec0542", + "set/bags.md": "70320231f84a49e34a31130eb71e5086", "_journal/2024-07-07.md": "9ee2d5007c34cc7ff681f3d9e998eca4", "_journal/2024-07/2024-07-06.md": "2b794e424985f0e7d4d899163ce5733c", "_journal/2024-07-08.md": "03ed5604e680ac9742ee99ae4b1eee8b", @@ -736,7 +737,7 @@ "_journal/2024-08/2024-08-07.md": "119c052f4109a3e098d825b771af89de", "_journal/2024-08-09.md": "2ce3e0c468f51750d8ad86a19bcc3264", "_journal/2024-08/2024-08-08.md": "b8211a4c576ff594217e2e9cae9396c0", - "data-structures/b-tree.md": "73d87a471173962a21ad059a709c55c4", + "data-structures/b-tree.md": "32673aceb58a3605e0386f490a7aaefc", "data-structures/binary-tree.md": "67b0b5b9688faa205983993fe507079a", "_journal/2024-08-10.md": "08e7ea4a78c46645b93ec51e2372d04f", "_journal/2024-08/2024-08-09.md": "2ce3e0c468f51750d8ad86a19bcc3264", @@ -760,7 +761,7 @@ "_journal/2024-08-19.md": "94836e52ec04a72d3e1dbf3854208f65", "_journal/2024-08/2024-08-18.md": "6f8aec69e00401b611db2a377a3aace5", "_journal/2024-08/2024-08-17.md": "b06a551560c377f61a1b39286cd43cee", - "calculus/bounds.md": "b410b7bc5beb5db799fe32b319745bb9", + "calculus/bounds.md": "e5b52df8a9d3f3b25d32598f24efd35d", "calculus/index.md": "5ee4d950533ae330ca5ef9e113fe87f3", "x86-64/instructions/conditions.md": "c5571deac40ac2eeb8666f2d3b3c278e", "_journal/2024-08-20.md": "e8bec308d1b29e411c6799ace7ef6571", @@ -779,15 +780,28 @@ "c17/enums.md": "9414fb67aa256a0a11b7240534c67bf6", "c17/derived-types.md": "6fb8f23a2423f05d5bdccb6672a32e38", "c17/basic-types.md": "7c6653bf6dc24c2f2aa72fc95c4f7875", - "c17/types/simple.md": "71f1bea1c8961c01325c24c6ad6007f6", + "c17/types/simple.md": "36445dec496b5f7a066bdb7738b2f17e", "c17/types/enumerated.md": "e1f70a30677c776b7b44ac3e0ff4e76d", "c17/types/derived.md": "aff0d2b6d218fb67af3cc92ead924de3", "c17/types/basic.md": "5064e21e683c0218890058882e06b6f3", - "c17/types/index.md": "b3e4f47b5f1f2a76d1d039e6263a41b8", + "c17/types/index.md": "7f8541016f9ac91cc6477fe864fdccd3", "_journal/2024-08-25.md": "e73a8edbd027d0f1a39289540eb512f2", "_journal/2024-08/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4", "algebra/abs-val.md": "a47bc08db62304eb526d15ede3e300cf", - "data-structures/graphs.md": "594d136ce637448641631c3647599c3a" + "data-structures/graphs.md": "594d136ce637448641631c3647599c3a", + "_journal/2024-08-26.md": "5bed1b0ee34e546c31760f5a0aa5ca19", + "_journal/2024-08/2024-08-25.md": "a3337b4658677810127350ef3e0ad146", + "_journal/2024-08-27.md": "d9ffc6ea2128ab5a86ab5f2619206736", + "_journal/2024-08/2024-08-26.md": "6f40716e2f01cd097d4881259babf1ba", + "c17/types/conversions.md": "d70d32534b0c0141daf47f289840b41a", + "_journal/2024-08-28.md": "c9c0e7ab8bcbf23d6332b3f19ec4d997", + "_journal/2024-08-30.md": "ff50eb8dd5124c20d4fa291d8b675238", + "_journal/2024-08/2024-08-28.md": "92e653379c8d7594bb23de4b330913fe", + "_journal/2024-08/2024-08-27.md": "d9ffc6ea2128ab5a86ab5f2619206736", + "_journal/2024-08/2024-08-29.md": "3e950ebf5f7e1cc125b23b736fd3f2d2", + "_journal/2024-09-01.md": "4a6536246b824636a50119d9065ea824", + "_journal/2024-08/2024-08-31.md": "f88a00ce067329b9ded07994c65817a7", + "_journal/2024-08/2024-08-30.md": "0eba0fb5127f435068b16d4cb6c64a43" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-08-25.md b/notes/_journal/2024-08/2024-08-25.md similarity index 100% rename from notes/_journal/2024-08-25.md rename to notes/_journal/2024-08/2024-08-25.md diff --git a/notes/_journal/2024-08/2024-08-26.md b/notes/_journal/2024-08/2024-08-26.md new file mode 100644 index 0000000..3e8bca8 --- /dev/null +++ b/notes/_journal/2024-08/2024-08-26.md @@ -0,0 +1,9 @@ +--- +title: "2024-08-26" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-08/2024-08-27.md b/notes/_journal/2024-08/2024-08-27.md new file mode 100644 index 0000000..1fc1912 --- /dev/null +++ b/notes/_journal/2024-08/2024-08-27.md @@ -0,0 +1,11 @@ +--- +title: "2024-08-27" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Notes on C's [[conversions#Usual Arithmetic Conversions|usual arithmetic conversions]]. \ No newline at end of file diff --git a/notes/_journal/2024-08/2024-08-28.md b/notes/_journal/2024-08/2024-08-28.md new file mode 100644 index 0000000..052434e --- /dev/null +++ b/notes/_journal/2024-08/2024-08-28.md @@ -0,0 +1,9 @@ +--- +title: "2024-08-28" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-08/2024-08-29.md b/notes/_journal/2024-08/2024-08-29.md new file mode 100644 index 0000000..d68f09d --- /dev/null +++ b/notes/_journal/2024-08/2024-08-29.md @@ -0,0 +1,9 @@ +--- +title: "2024-08-29" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-08/2024-08-30.md b/notes/_journal/2024-08/2024-08-30.md new file mode 100644 index 0000000..cd571b9 --- /dev/null +++ b/notes/_journal/2024-08/2024-08-30.md @@ -0,0 +1,9 @@ +--- +title: "2024-08-30" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-08/2024-08-31.md b/notes/_journal/2024-08/2024-08-31.md new file mode 100644 index 0000000..7ec222c --- /dev/null +++ b/notes/_journal/2024-08/2024-08-31.md @@ -0,0 +1,9 @@ +--- +title: "2024-08-31" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-09/2024-09-01.md b/notes/_journal/2024-09/2024-09-01.md new file mode 100644 index 0000000..015ceb8 --- /dev/null +++ b/notes/_journal/2024-09/2024-09-01.md @@ -0,0 +1,11 @@ +--- +title: "2024-09-01" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Notes on C [[c17/declarations#Initializers|initializers]]. \ No newline at end of file diff --git a/notes/_journal/2024-09/2024-09-02.md b/notes/_journal/2024-09/2024-09-02.md new file mode 100644 index 0000000..4aa07e8 --- /dev/null +++ b/notes/_journal/2024-09/2024-09-02.md @@ -0,0 +1,9 @@ +--- +title: "2024-09-01" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-09/2024-09-03.md b/notes/_journal/2024-09/2024-09-03.md new file mode 100644 index 0000000..4aa07e8 --- /dev/null +++ b/notes/_journal/2024-09/2024-09-03.md @@ -0,0 +1,9 @@ +--- +title: "2024-09-01" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-09/2024-09-04.md b/notes/_journal/2024-09/2024-09-04.md new file mode 100644 index 0000000..4aa07e8 --- /dev/null +++ b/notes/_journal/2024-09/2024-09-04.md @@ -0,0 +1,9 @@ +--- +title: "2024-09-01" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-09/2024-09-05.md b/notes/_journal/2024-09/2024-09-05.md new file mode 100644 index 0000000..a80ddca --- /dev/null +++ b/notes/_journal/2024-09/2024-09-05.md @@ -0,0 +1,9 @@ +--- +title: "2024-09-05" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/algebra/boolean.md b/notes/algebra/boolean.md index 22dc306..b7169bb 100644 --- a/notes/algebra/boolean.md +++ b/notes/algebra/boolean.md @@ -55,7 +55,7 @@ END%% %%ANKI Basic What C logical operator corresponds to $\land$? -Back: N/A +Back: N/A. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c17 @@ -64,7 +64,7 @@ END%% %%ANKI Basic What C logical operator corresponds to $\lor$? -Back: N/A +Back: N/A. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c17 @@ -73,7 +73,7 @@ END%% %%ANKI Basic What C logical operator corresponds to $\Rightarrow$? -Back: N/A +Back: N/A. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c17 diff --git a/notes/c17/declarations.md b/notes/c17/declarations.md index 6a3f1bf..c457f22 100644 --- a/notes/c17/declarations.md +++ b/notes/c17/declarations.md @@ -323,8 +323,99 @@ Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Progra END%% +## Initializers + +An **initializer** is an expression that gives an object a value at time of declaration. Only variable-length arrays (VLAs) do not allow for an initializer. The default initializer looks like `{0}`. + +%%ANKI +Basic +Which part of the following are initializers? +```c +int a = 3; +``` +Back: `3` +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +Which part of the following are initializers? +```c +double a = { 7.0 }; +``` +Back: `{ 7.0 }` +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +Which part of the following are initializers? +```c +double a = { 7.0 }; +``` +Back: `{ 7.0 }` +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). +END%% + +%%ANKI +Basic +How is the following updated to include initializers `1` and `2` for `a` and `b` respectively? +```c +int a, b; +``` +Back: +```c +int a = 1, b = 2; +``` +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +What object types allow initializers? +Back: All but VLAs. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +What object types do not allow initializers? +Back: Just variable-length arrays. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +What is the default initializer? +Back: `{0}` +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +`{0}` is a valid initializer for what object types? +Back: All but VLAs. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +`{0}` is not a valid initializer for what object types? +Back: Just variable-length arrays. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + ## Bibliography * Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. * “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). +* Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). * Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994. diff --git a/notes/c17/index.md b/notes/c17/index.md index 91254d6..d01996c 100644 --- a/notes/c17/index.md +++ b/notes/c17/index.md @@ -107,7 +107,7 @@ END%% %%ANKI Basic Why are lvalues named the way they are? -Back: The name is an acronym for **l**ocator **value**. +Back: The name is an acronym for **l**ocator **value** (or **l**eft **value**). Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). END%% diff --git a/notes/c17/types/conversions.md b/notes/c17/types/conversions.md new file mode 100644 index 0000000..1e7267b --- /dev/null +++ b/notes/c17/types/conversions.md @@ -0,0 +1,302 @@ +--- +title: Conversions +TARGET DECK: Obsidian::STEM +FILE TAGS: c17::type +tags: + - c17 +--- + +## Overview + +> Several operators convert operand values from one type to another automatically. + +The above quote refers to **implicit conversions**. Alternatively, we can use cast operations to perform **explicit conversions**. + +## Usual Arithmetic Conversions + +As a general rule, the result of an operation has the type of the operand with wider range. The usual arithmetic conversions behave according to the following pattern: + +1. Determine a **common real type** for the operands and result. +2. Convert each operand, without change of type domain, to a type with real type matching the common real type. +3. Unless explicitly stated otherwise, the common real type is the corresponding real type of the result, whose type domain is that of the operands if they are the same and complex otherwise. + +Common real types are prioritized in the following order: + +1. `long double` +2. `double` +3. `float` +4. If both operands have the same signedness, the higher ranked type. +5. If the unsigned operand has rank $\geq$ than that of the other, the unsigned type. +6. If the signed operand's includes that of the other, the signed type. +7. The unsigned integer type corresponding to that of the signed integer type. + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +long double a; +long double complex b; +``` +Back: `long double` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +long double a; +long complex b; +``` +Back: `long double` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +long double a; +long complex b; +``` +Back: Complex. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +double complex a; +long b; +``` +Back: `double` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +long double a; +long complex b; +``` +Back: Complex. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +float a; +double b; +``` +Back: `double` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +long long a; +float b; +``` +Back: `float` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +long long a; +float b; +``` +Back: Real. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +*Why* is the common real type of `a` and `b` equal to `float`? +```c +long long a; +float b; +``` +Back: Because floating-point types have priority over integer types. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +long long a; +long long b; +``` +Back: Real. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +long long a; +long long b; +``` +Back: `long long` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +unsigned int a; +signed short b; +``` +Back: `unsigned int` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the common real type of `a` and `b`? +```c +unsigned a; +signed int b; +``` +Back: `unsigned` +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +*Why* is the common real type of `a` and `b` equal to `unsigned`? +```c +unsigned a; +signed int b; +``` +Back: Because `unsigned` has rank $\geq$ that of `signed int`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +unsigned a; +signed int b; +``` +Back: Real. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What is the type domain of `a + b`? +```c +unsigned short a; +signed int b; +``` +Back: Indeterminate. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +*Why* is the type domain of `a + b` indeterminate? +```c +unsigned short a; +int b; +``` +Back: Because the rank of `unsigned short` is $<$ that of `int`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +What *might* the type domain of `a + b` be? +```c +unsigned short a; +signed int b; +``` +Back: `signed int` or `unsigned int`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +When is the type domain of `a + b` equal to `signed int`? +```c +unsigned short a; +signed int b; +``` +Back: When `signed int` can represent all the values of `unsigned short`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +When is the type domain of `a + b` equal to `unsigned int`? +```c +unsigned short a; +signed int b; +``` +Back: When `signed int` cannot represent all the values of `unsigned short`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +When is the type domain of `a + b` equal to `unsigned short`? +```c +unsigned short a; +signed int b; +``` +Back: N/A. It never is. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +Suppose `a` and `b` has signed and unsigned types. When is `a + b` signed? +Back: When `b`'s type has lower rank and the range of `b` is included in the range of `a`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +%%ANKI +Basic +Suppose `a` and `b` has signed and unsigned types. When is `a + b` unsigned? +Back: When `b`'s type has higher rank or the range of `a` cannot fit the range of `b`. +Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). + +END%% + +## Bibliography + +* “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). \ No newline at end of file diff --git a/notes/c17/types/index.md b/notes/c17/types/index.md index c51585f..71d09b3 100644 --- a/notes/c17/types/index.md +++ b/notes/c17/types/index.md @@ -124,6 +124,39 @@ Reference: ISO: Programming Languages - C,” April 12, 2011, [https://port70.ne END%% +%%ANKI +Basic +Does `x` have complete or incomplete object type in the following? +```c +double x[]; +``` +Back: Incomplete. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +Does `x` have complete or incomplete object type in the following? +```c +double x[] = { 1, 2, }; +``` +Back: Incomplete. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + +%%ANKI +Basic +Does `x` have complete or incomplete object type in the following? +```c +double x[2] = { 1, 2, }; +``` +Back: Complete. +Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). + +END%% + %%ANKI Basic What object type can an lvalue *not* have? @@ -199,7 +232,7 @@ END%% %%ANKI Basic The integer types consist of what simple types? -Back: `char`, signed/unsigned integer types, and `enum`s. +Back: `char`, (un)signed integer types, and `enum`s. Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). END%% @@ -255,7 +288,7 @@ END%% %%ANKI Basic Which types are considered both basic types and integer types? -Back: `char` and the signed/unsigned integer types. +Back: `char` and the (un)signed integer types. Reference: “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). END%% @@ -392,4 +425,5 @@ END%% ## Bibliography -* “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). \ No newline at end of file +* “ISO: Programming Languages - C,” April 12, 2011, [https://port70.net/~nsz/c/c11/n1570.pdf](https://port70.net/~nsz/c/c11/n1570.pdf). +* Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). \ No newline at end of file diff --git a/notes/c17/types/simple.md b/notes/c17/types/simple.md index 7c3c7f3..2f32e8b 100644 --- a/notes/c17/types/simple.md +++ b/notes/c17/types/simple.md @@ -452,14 +452,6 @@ Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co END%% -%%ANKI -Basic -The first fit rule excludes what subcategory of integer types? -Back: The narrow integers. -Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). - -END%% - %%ANKI Basic What is the signedness of a decimal integer literal? diff --git a/notes/calculus/bounds.md b/notes/calculus/bounds.md index 47d42bf..41d0a1e 100644 --- a/notes/calculus/bounds.md +++ b/notes/calculus/bounds.md @@ -111,7 +111,7 @@ END%% %%ANKI Basic What is the maximum element of interval $[0, 1] \subseteq \mathbb{R}$? -Back: $1$. +Back: $1$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -143,7 +143,7 @@ END%% %%ANKI Basic What is the minimum element of interval $[0, 1] \subseteq \mathbb{R}$? -Back: $0$. +Back: $0$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -203,7 +203,7 @@ END%% %%ANKI Basic What distinguishes a supremum from a least upper bound? -Back: They are synonyms of one another. +Back: N/A. They are synonyms of one another. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -219,7 +219,7 @@ END%% %%ANKI Basic What is the least upper bound of interval $[0, 1] \subseteq \mathbb{R}$? -Back: $1$. +Back: $1$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -227,7 +227,7 @@ END%% %%ANKI Basic What is the supremum of interval $(0, 1) \subseteq \mathbb{R}$? -Back: $1$. +Back: $1$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -307,7 +307,7 @@ END%% %%ANKI Basic Let $A, B \subseteq \mathbb{R}$. When is $\mathop{\text{sup}} \,\{a + b \mid a \in A, b \in B\}$ defined? -Back: When $A$ and $B$ both have a supremum. +Back: When $A$ and $B$ both have supremums. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -315,7 +315,7 @@ END%% %%ANKI Basic Let $A, B \subseteq \mathbb{R}$. When is $\mathop{\text{inf}} \,\{a + b \mid a \in A, b \in B\}$ defined? -Back: When $A$ and $B$ both have an infimum. +Back: When $A$ and $B$ both have infimums. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -383,7 +383,7 @@ END%% %%ANKI Basic Consider $\varnothing \subseteq \mathbb{R}$. Why doesn't the completeness axiom of real numbers apply? -Back: It only applies to nonempty sets. +Back: $\varnothing$ is not a nonempty set. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -399,7 +399,7 @@ END%% %%ANKI Basic Consider $\mathbb{R}^+$. Why doesn't the completeness axiom apply? -Back: It only applies to nonempty sets that are bounded above. +Back: $\mathbb{R}^+$ is not bounded above. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -426,7 +426,7 @@ A number $B$ is called a **greatest lower bound** (or **infimum**) of a nonempty %%ANKI Basic -Let $\varnothing \subset S \subseteq \mathbb{R}$. What is a greatest upper bound of $S$? +Let $\varnothing \subset S \subseteq \mathbb{R}$. What is a greatest lower bound of $S$? Back: A lower bound $B$ for $S$ such that no number greater than $B$ is also a lower bound for $S$. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). @@ -459,7 +459,7 @@ END%% %%ANKI Basic What distinguishes a greatest lower bound from an infimum? -Back: They are synonyms of one another. +Back: N/A. They are synonyms of one another. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -467,7 +467,7 @@ END%% %%ANKI Basic What distinguishes an infimum from a minimum? -Back: A supremum is not necessarily a member of the reference set. +Back: An infimum is not necessarily a member of the reference set. Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -475,7 +475,7 @@ END%% %%ANKI Basic What is the infimum of interval $[0, 1] \subseteq \mathbb{R}$? -Back: $0$. +Back: $0$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% @@ -483,7 +483,7 @@ END%% %%ANKI Basic What is the greatest lower bound of interval $(0, 1) \subseteq \mathbb{R}$? -Back: $0$. +Back: $0$ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). END%% diff --git a/notes/data-structures/b-tree.md b/notes/data-structures/b-tree.md index c629851..6f7c431 100644 --- a/notes/data-structures/b-tree.md +++ b/notes/data-structures/b-tree.md @@ -132,7 +132,7 @@ END%% %%ANKI Basic -Consider a B-tree of order $7$. How many children $c$ can each non-root node have? +Consider a B-tree of order $7$. How many children $c$ can each internal non-root node have? Back: $4 \leq c \leq 7$ Reference: Donald Ervin Knuth, _Art of Computer Programming, 3: Sorting and Searching_, 2. ed., 34. (Reading, Mass: Addison-Wesley, 1995). @@ -141,14 +141,14 @@ END%% %%ANKI Basic Consider a B-tree of order $7$. How many children $c$ can the root have? -Back: $1 \leq c \leq 7$ +Back: $0 \leq c \leq 7$ Reference: Donald Ervin Knuth, _Art of Computer Programming, 3: Sorting and Searching_, 2. ed., 34. (Reading, Mass: Addison-Wesley, 1995). END%% %%ANKI Basic -Consider a B-tree of order $7$. How many keys $k$ can each non-root node have? +Consider a B-tree of order $7$. How many keys $k$ can each internal non-root node have? Back: $3 \leq k < 7$ Reference: Donald Ervin Knuth, _Art of Computer Programming, 3: Sorting and Searching_, 2. ed., 34. (Reading, Mass: Addison-Wesley, 1995). diff --git a/notes/lambda-calculus/beta-reduction.md b/notes/lambda-calculus/beta-reduction.md index 1e4438a..64385a4 100644 --- a/notes/lambda-calculus/beta-reduction.md +++ b/notes/lambda-calculus/beta-reduction.md @@ -689,7 +689,7 @@ END%% %%ANKI Basic -What does the Church-Rosser theorem state in terms of confluence? +What does the Church-Rosser theorem of $\,\triangleright_\beta\,$ state in terms of confluence? Back: $\beta$-reduction is confluent. Reference: Hindley, J Roger, and Jonathan P Seldin. “Lambda-Calculus and Combinators, an Introduction,” n.d. [https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf](https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf). diff --git a/notes/set/bags.md b/notes/set/bags.md index 48b318f..d88c3ee 100644 --- a/notes/set/bags.md +++ b/notes/set/bags.md @@ -116,7 +116,7 @@ END%% %%ANKI Basic -Do all multisets correspond to sets? +Is every multiset a set? Back: No. Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725). @@ -124,7 +124,7 @@ END%% %%ANKI Basic -Do all sets correspond to multisets? +Is every set a multiset? Back: Yes. Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725). diff --git a/notes/set/index.md b/notes/set/index.md index b0245cb..2822033 100644 --- a/notes/set/index.md +++ b/notes/set/index.md @@ -276,7 +276,7 @@ END%% %%ANKI Cloze -$\exists u \in A, uFx$ is equivalently written as $x \in$ {$\{v \mid \exists u \in A, uFv\}$}. +$\exists u \in A, uFx$ is equivalently written as $x \in$ {$F[\![A]\!]$}. Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). END%% @@ -1129,7 +1129,7 @@ END%% %%ANKI Cloze -The {infinity axiom} asserts the existence of an {inductive set}. +The {infinity} axiom asserts the existence of an {inductive set}. Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). END%% diff --git a/notes/x86-64/registers.md b/notes/x86-64/registers.md index 61edc97..e101514 100644 --- a/notes/x86-64/registers.md +++ b/notes/x86-64/registers.md @@ -86,7 +86,7 @@ END%% %%ANKI Basic How many bytes make up the `%rax` register? -Back: $8$. +Back: $8$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -94,7 +94,7 @@ END%% %%ANKI Basic How many bytes make up the `%ax` register? -Back: $2$. +Back: $2$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -102,7 +102,7 @@ END%% %%ANKI Basic How many bytes make up the `%al` register? -Back: $1$. +Back: $1$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -110,7 +110,7 @@ END%% %%ANKI Basic How many bytes make up the `%eax` register? -Back: $4$. +Back: $4$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -163,7 +163,7 @@ END%% %%ANKI Basic How many bytes make up the `%rsp` register? -Back: $8$. +Back: $8$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -171,7 +171,7 @@ END%% %%ANKI Basic How many bytes make up the `%sp` register? -Back: $2$. +Back: $2$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -179,7 +179,7 @@ END%% %%ANKI Basic How many bytes make up the `%spl` register? -Back: $1$. +Back: $1$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -187,7 +187,7 @@ END%% %%ANKI Basic How many bytes make up the `%esp` register? -Back: $4$. +Back: $4$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -272,7 +272,7 @@ END%% %%ANKI Basic From smallest to largest, list the four "return value" registers. -Back: `%al`, `%ax`, `%eax`, and `$rax`. +Back: `%al`, `%ax`, `%eax`, and `%rax`. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -280,7 +280,7 @@ END%% %%ANKI Basic From smallest to largest, list the four "stack pointer" registers. -Back: `%spl`, `%sp`, `%esp`, and `$rsp`. +Back: `%spl`, `%sp`, `%esp`, and `%rsp`. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%%