diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 77da5cd..24c0d60 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -92,7 +92,7 @@ "bash/shebang.md": "9006547710f9a079a3666169fbeda7aa", "c/escape-sequences.md": "7b4bbf159908320249158acfe47a9074", "c/index.md": "a021c92f19831bdd2bca4cbf813882fe", - "gawk/index.md": "dd851e023e11c556c0272a0dcb6dd55d", + "gawk/index.md": "e4da41ba6a2c2602d9f15f2930608e3c", "gawk/variables.md": "73b12bd0d7d6f97b4a7285aaf2c45bfa", "index.md": "e48e895feeed7046425bb2ee15419770", "journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", @@ -100,7 +100,7 @@ "journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "journal/2024-02-03.md": "c6d411f0e2e964270399dd3a99f48382", "logic/index.md": "46cdc7a552900e99a7d2d0140971118c", - "logic/propositional.md": "c438bdad405832e3c180469e961539cc", + "logic/propositional.md": "41e1490c98a249a6d435f896f08a856b", "lua/index.md": "fd3d0b66765f0e9df233e8e02ce33e94", "nix/callPackage.md": "140a02e57cd01d646483e3c21d72243d", "nix/index.md": "4efc7fcc4ea22834ba595497e5fb715c", @@ -118,21 +118,21 @@ "_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", - "logic/equiv-trans.md": "08ad9c814f0a46981b218a9c7cc8a3b8", + "logic/equiv-trans.md": "b22c24a523d2acd4e44083f492c0017b", "_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", - "algorithms/loop-invariant.md": "d883dfc997ee28a7a1e24b995377792b", + "algorithms/loop-invariant.md": "29f9f9090a3109890d333a78acc18b50", "algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65", "algorithms/order-growth.md": "5fb2e3ccfc3710be7396a37da7c4f162", "_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac", "algorithms/sorting/selection-sort.md": "fcd0dc2ebaabd0a4db1baf7e7ef9f7a9", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", "binary/hexadecimal.md": "c3d485f1fd869fe600334ecbef7d5d70", - "binary/index.md": "d97bddf94227df5903a2929febf25606", + "binary/index.md": "9089c6f0e86a0727cd03984f51350de0", "_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109", "c/types.md": "cf3e66e5aee58a94db3fdf0783908555", "logic/quantification.md": "5d7579a511e9ff683edeec62bcc291b8", - "c/declarations.md": "94c85cb1a09efed2cad6b5b80e9d0be3", + "c/declarations.md": "2de27f565d1020819008ae80593af435", "algorithms/sorting/bubble-sort.md": "16dad1016dc6555163e42ba20f1d152d", "_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f", "_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", @@ -147,36 +147,36 @@ "_journal/2024-02/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-02/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f", "_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32", - "binary/endianness.md": "54c86119d0b7fadcc0ee86da2ef5b900", + "binary/endianness.md": "1c579ea9106ec6b9c756608118a1f34d", "logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14", "_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd", "_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32", "encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71", "encoding/index.md": "071cfa6a5152efeda127b684f420d438", - "c/strings.md": "04b04e2c227e600adb48c74b2dee62b1", + "c/strings.md": "aba6e449906d05aee98e3e536eb43742", "logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f", - "logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300", - "logic/boolean-algebra.md": "f9101b2dfdedb73dc13c34c1a70a0010", + "logic/short-circuit.md": "e088e62ead26779f9a51dfd1caeeb9d4", + "logic/boolean-algebra.md": "00dc2cdc93d6b0e0e60c975ba87f8633", "_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0", "_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44", - "binary/shifts.md": "ce6f2d80536b8a8b3f05383ce2190e72", + "binary/shifts.md": "c2ad95420b3aab03021510d46703ebb2", "_journal/2024-02-14.md": "76d1b607470305fb3f00a47b8e9ece27", "_journal/2024-02/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0", "_journal/2024-02-15.md": "575ba46d692795d9606de9e635d1f4ac", "_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520", "_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db", "_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed", - "algebra/floor-ceiling.md": "efc4502ed22128e14b20ba88b368a872", + "algebra/floor-ceiling.md": "e9f905f5ec01921e0f19afe8732fb38b", "algebra/index.md": "90b842eb694938d87c7c68779a5cacd1", "algorithms/binary-search.md": "08cb6dc2dfb204a665d8e8333def20ca", "_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048", "_journal/2024-02/2024-02-16.md": "e701902e369ec53098fc2deed4ec14fd", - "binary/integer-encoding.md": "afe5e82b534fc5ab409b188addab36f4", + "binary/integer-encoding.md": "95571264710f244da40c8203ad1de993", "combinatorics/index.md": "f9de9671fdb6068ef2bb5e63051734be", "_journal/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", "_journal/2024-02/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048", - "combinatorics/multiplicative-principle.md": "3e4f600f5300d3d4d64099b8f2bd1458", - "combinatorics/additive-principle.md": "84dcd0243263b3c53456086ae43fa00f", + "combinatorics/multiplicative-principle.md": "eae60248d68ba8bd2da5e4c3fea70109", + "combinatorics/additive-principle.md": "e968028670f95ee9a7c5499ff7cb6792", "_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a", "_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", "combinatorics/permutations.md": "606b4b2b8018797ca54857112235d96e", @@ -188,7 +188,13 @@ "_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841", "algebra/radices.md": "0fcd901c798eaed8075ff1375e2429dd", "_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a", - "_journal/2024-02/2024-02-21.md": "a627f267700f36abd5ceb9b4c294479e" + "_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7", + "_journal/2024-02-23.md": "9750fc77ccd67fd29dc5af0cdc0d16b7", + "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", + "c17/strings.md": "bbe8983602adbeb38eff214beddedd84", + "c17/index.md": "78576ee41d0185df82c59999142f4edb", + "c17/escape-sequences.md": "ebc63c6cdfbe60bbc2708c1b0c8da8bb", + "c17/declarations.md": "d8920390eae79da5d9be08d050ca1b51" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-02-23.md b/notes/_journal/2024-02-23.md new file mode 100644 index 0000000..44f24c2 --- /dev/null +++ b/notes/_journal/2024-02-23.md @@ -0,0 +1,19 @@ +--- +title: "2024-02-23" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [x] OGS (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) +- [ ] Interview Prep (1 Practice Problem) +- [ ] Log Work Hours (Max 3 hours) + +* 101weiqi (serial numbers) + * Q-28857 + * Q-120650 + * Q-123426 + * Q-10929 + * Q-10924 + * Q-9107 \ No newline at end of file diff --git a/notes/_journal/2024-02-22.md b/notes/_journal/2024-02/2024-02-22.md similarity index 100% rename from notes/_journal/2024-02-22.md rename to notes/_journal/2024-02/2024-02-22.md diff --git a/notes/algebra/floor-ceiling.md b/notes/algebra/floor-ceiling.md index 7dfb5f7..520d0b9 100644 --- a/notes/algebra/floor-ceiling.md +++ b/notes/algebra/floor-ceiling.md @@ -119,7 +119,7 @@ Basic How does C evaluate `10 / 3`? Back: `3` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -128,7 +128,7 @@ Basic How does C evaluate `floor(10.f / 3)`? Back: `3` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -137,7 +137,7 @@ Basic How does C evaluate `ceil(10.f / 3)`? Back: `4` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -146,7 +146,7 @@ Basic How does C evaluate `-10 / 3`? Back: `-3` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -155,7 +155,7 @@ Basic How does C evaluate `floor(-10.f / 3)`? Back: `-4` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -164,7 +164,7 @@ Basic How does C evaluate `ceil(-10.f / 3)`? Back: `-3` Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). -Tags: c +Tags: c17 END%% @@ -195,7 +195,7 @@ END%% %%ANKI Basic If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r]` and `A[r+1..q]`? -Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$ +Back: $r = (p + q) / 2$ Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). END%% @@ -203,7 +203,7 @@ END%% %%ANKI Basic If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r-1]` and `A[r..q]`? -Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$ +Back: $r = (p + q) / 2$ Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). END%% @@ -211,7 +211,7 @@ END%% %%ANKI Basic If `A[p..q]` has odd size, what `r` ensures `A[p..r-1]` has same size as `A[r+1..q]`? -Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$ +Back: $r = (p + q) / 2$ Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). END%% diff --git a/notes/algorithms/loop-invariant.md b/notes/algorithms/loop-invariant.md index 877062c..9e2d139 100644 --- a/notes/algorithms/loop-invariant.md +++ b/notes/algorithms/loop-invariant.md @@ -57,7 +57,7 @@ for (int i = 0; i < n; ++i) { ... } ``` Back: After `int i = 0` but before `i < n`. Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009). -Tags: c +Tags: c17 END%% diff --git a/notes/binary/endianness.md b/notes/binary/endianness.md index 1983269..0a8d31b 100644 --- a/notes/binary/endianness.md +++ b/notes/binary/endianness.md @@ -80,7 +80,7 @@ Basic How are bytes of `int32_t x = 0x01234567` written in big-endian? Back: `0x01 0x23 0x45 0x67` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -89,7 +89,7 @@ Basic How are bytes of `int32_t x = 0x01234567` written in little-endian? Back: `0x67 0x45 0x23 0x01` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% diff --git a/notes/binary/index.md b/notes/binary/index.md index bb4ac34..98cb4eb 100644 --- a/notes/binary/index.md +++ b/notes/binary/index.md @@ -42,7 +42,7 @@ Basic How might you use C to find the weight of a bit string? Back: Repeatedly divide by `2`, counting all remainders of `1`. Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). -Tags: c +Tags: c17 END%% diff --git a/notes/binary/integer-encoding.md b/notes/binary/integer-encoding.md index 642f4c7..946322f 100644 --- a/notes/binary/integer-encoding.md +++ b/notes/binary/integer-encoding.md @@ -23,7 +23,7 @@ Basic What is a C integral type? Back: A type representing finite ranges of integers. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -32,7 +32,7 @@ Basic In what two ways are C integral types encoded? Back: Unsigned encoding or two's-complement. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -548,7 +548,7 @@ END%% ## Casting -Most implementations of C cast an object of one type to another by simply re-interpreting their binary representation. This casting may happen implicitly if comparing or operating on e.g. `signed` and `unsigned` objects in the same expression. $T2U$ and $U2T$ reflect this method of casting: +Most implementations of C cast an object of one type to another by simply re-interpreting the object's binary representation. This casting may happen implicitly if comparing or operating on e.g. `signed` and `unsigned` objects in the same expression. $T2U$ and $U2T$ reflect this method of casting: $$T2U_w(x) = \begin{cases} x + 2^w & x < 0 \\ @@ -565,7 +565,7 @@ Basic How do most implementations of C perform casting? Back: As a reinterpretation of the same byte pattern of the object being casted. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -579,10 +579,10 @@ END%% %%ANKI Basic -For what decimal values $x$ does $T2U_w$ and $U2T_w$ serve as the identity function? +For what values $x$ does $T2U_w(x) = U2T_w(x) = x$? Back: $0 \leq x \leq TMax_w$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - + END%% %%ANKI @@ -590,7 +590,7 @@ Basic What values $x$ are unaffected when casting from `signed` to `unsigned`? Back: $0 \leq x \leq TMax_w$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -599,7 +599,7 @@ Basic What values $x$ are unaffected when casting from `unsigned` to `signed`? Back: $0 \leq x \leq TMax_w$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -608,7 +608,7 @@ Basic How are casts implicitly performed in operations containing `signed` and `unsigned` objects? Back: `signed` objects are cast to `unsigned` objects. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -664,6 +664,92 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program END%% +### Expansion + +For unsigned encoding, use **zero extension** to convert numbers to larger types. For example, $1010_2$ can be expanded to 8-bit $00001010_2$. + +%%ANKI +Cloze +Use {zero} extension to convert {unsigned} numbers to larger types. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Zero extension is generally used for what type of integer encoding? +Back: Unsigned. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +*Why* does zero extension of unsigned numbers work? +Back: The weights of additional bits are zeroed out. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +*Why* does zero extension of two's-complement numbers generally not work? +Back: A negative value would have its new sign bit be positive. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is $\langle x_3, x_2, x_1, x_0 \rangle$ zero extended to 8 bits? +Back: As $\langle 0, 0, 0, 0, x_3, x_2, x_1, x_0 \rangle$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +For two's-complement, use **sign extension** to convert numbers to larger types. This means the additional leftmost bits are set to match the sign bit of the original number. For example, $1010_2$ can be expanded to 8-bit $11111010_2$. + +%%ANKI +Cloze +Use {sign} extension to convert {two's-complement} numbers to larger types. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Sign extension is generally used for what type of integer encoding? +Back: Two's-complement. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +*Why* does sign extension of two's-complement numbers work? +Back: The new sign bit weight is equal to the swing in the previous sign bit weight. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +*Why* does sign extension of unsigned numbers generally not work? +Back: It actually does, though we technically call it zero extension. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is $\langle x_3, x_2, x_1, x_0 \rangle$ sign extended to 8 bits? +Back: As $\langle x_3, x_3, x_3, x_3, x_3, x_2, x_1, x_0 \rangle$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +### Truncation + ## References * Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/binary/shifts.md b/notes/binary/shifts.md index cfb0b32..3de08dd 100644 --- a/notes/binary/shifts.md +++ b/notes/binary/shifts.md @@ -79,7 +79,7 @@ Basic What portability issue do shift operations introduce? Back: There is no standard on whether right shifts of signed numbers are logical or arithmetic. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -87,7 +87,7 @@ END%% Cloze {1:Arithmetic} right shifts are to {1:signed} numbers whereas {2:logical} right shifts are to {2:unsigned} numbers. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -98,7 +98,7 @@ Basic Ignoring UB, what *typically* happens when shifting an `int32_t` by `k ≥ 32` bits? Back: The shift value is interpreted as `k mod 32`. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% @@ -107,7 +107,7 @@ Basic How is $x \bmod 2^k$ equivalently written as a bit mask? Back: `x & ((1 << k) - 1)` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tags: c +Tags: c17 END%% diff --git a/notes/c/index.md b/notes/c/index.md deleted file mode 100644 index 7dbbda9..0000000 --- a/notes/c/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: C -tags: - - c ---- diff --git a/notes/c/declarations.md b/notes/c17/declarations.md similarity index 89% rename from notes/c/declarations.md rename to notes/c17/declarations.md index 9d1f6b8..28baff8 100644 --- a/notes/c/declarations.md +++ b/notes/c17/declarations.md @@ -1,9 +1,9 @@ --- title: Declarations TARGET DECK: Obsidian::STEM -FILE TAGS: c +FILE TAGS: c17 tags: - - c + - c17 --- ## Overview @@ -207,14 +207,14 @@ END%% Negative integer literals are typed in a counterintuitive way. When the compiler sees a number of form `-X`, the type of `X` is first determined *before* then being negated. Promotion rules are as follows: -C90 (Decimal) | C90 (Other) | C99 (Decimal) | C99 (Other) ---------------- | --------------- | ------------- | --------- -`int` | `int` | `int` | `int` -`long` | `unsigned` | `long` | `unsigned` -`unsigned` | `long` | `long long` | `long` -`unsigned long` | `unsigned long` | `-` | `unsigned long` -`-` | `-` | `-` | `long long` -`-` | `-` | `-` | `unsigned long long` +Decimal | Other Bases +----------- | -------------------- +`int` | `int` +`long` | `unsigned` +`long long` | `long` +`-` | `unsigned long` +`-` | `long long` +`-` | `unsigned long long` %%ANKI Basic @@ -226,31 +226,7 @@ END%% %%ANKI Basic -What simplification did C99 introduce to decimal integer literals? -Back: The integer constant is guaranteed a `signed` type. -Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Basic -Since what standard was it guaranteed decimal integer literals were `signed`? -Back: C99 -Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Basic -In ISO C90, what integer literals are guaranteed `signed`? -Back: None. -Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Basic -In ISO C99, what integer literals are guaranteed `signed`? +What integer literals are guaranteed `signed`? Back: Decimal integer constants. Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/c/escape-sequences.md b/notes/c17/escape-sequences.md similarity index 99% rename from notes/c/escape-sequences.md rename to notes/c17/escape-sequences.md index c30712c..dd4a757 100644 --- a/notes/c/escape-sequences.md +++ b/notes/c17/escape-sequences.md @@ -1,9 +1,9 @@ --- title: Escape Sequences TARGET DECK: Obsidian::STEM -FILE TAGS: c +FILE TAGS: c17 tags: - - c + - c17 --- ## Overview diff --git a/notes/c17/index.md b/notes/c17/index.md new file mode 100644 index 0000000..014185c --- /dev/null +++ b/notes/c17/index.md @@ -0,0 +1,5 @@ +--- +title: C17 +tags: + - c17 +--- diff --git a/notes/c/strings.md b/notes/c17/strings.md similarity index 97% rename from notes/c/strings.md rename to notes/c17/strings.md index b27e142..a2d3596 100644 --- a/notes/c/strings.md +++ b/notes/c17/strings.md @@ -1,9 +1,9 @@ --- title: Strings TARGET DECK: Obsidian::STEM -FILE TAGS: c +FILE TAGS: c17 tags: - - c + - c17 --- ## Overview @@ -164,7 +164,7 @@ END%% %%ANKI Basic -The `-` flag overrides what default behavior? +The `-` `printf` flag overrides what default behavior? Back: Output is right-aligned by default. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -172,14 +172,14 @@ END%% %%ANKI Cloze -The {`+`} flag {prepends a plus for positive signed-numeric types}. +The {`+`} `printf` flag {prepends a plus for positive signed-numeric types}. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). END%% %%ANKI Basic -The `+` flag overrides what default behavior? +The `+` `printf` flag overrides what default behavior? Back: Nothing is prepended to positive signed-numeric types by default. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -187,14 +187,14 @@ END%% %%ANKI Cloze -The {`␣`} flag {prepends a space for positive signed-numeric types}. +The {`␣`} `printf` flag {prepends a space for positive signed-numeric types}. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). END%% %%ANKI Basic -The `␣` flag overrides what default behavior? +The `␣` `printf` flag overrides what default behavior? Back: Nothing is prepended to positive signed-numeric types by default. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -202,7 +202,7 @@ END%% %%ANKI Basic -How do the `+` and `␣` flags relate to one another? +How do the `+` and `␣` `printf` flags relate to one another? Back: Both prepend a character to positive signed-numeric types. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -210,7 +210,7 @@ END%% %%ANKI Basic -What happens if both the `+` and `␣` flags are specified? +What happens if both the `+` and `␣` `printf` flags are specified? Back: The `+` flag takes precedence. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -218,14 +218,14 @@ END%% %%ANKI Cloze -The {`0`} flag {prepends zeros for numeric types}. +The {`0`} `printf` flag {prepends zeros for numeric types}. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). END%% %%ANKI Basic -What option must be specified for the `0` flag to take effect? +What option must be specified for the `0` `printf` flag to take effect? Back: The "width" option. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). @@ -233,7 +233,7 @@ END%% %%ANKI Basic -The `0` flag overrides what default behavior? +The `0` `printf` flag overrides what default behavior? Back: Spaces are used to match the "width" option by default. Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). diff --git a/notes/combinatorics/additive-principle.md b/notes/combinatorics/additive-principle.md index b5ace68..3293a08 100644 --- a/notes/combinatorics/additive-principle.md +++ b/notes/combinatorics/additive-principle.md @@ -42,7 +42,7 @@ Basic Which C construct corresponds to the additive property? Back: `union` Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). -Tags: c +Tags: c17 END%% diff --git a/notes/combinatorics/multiplicative-principle.md b/notes/combinatorics/multiplicative-principle.md index 6894837..b45ad6c 100644 --- a/notes/combinatorics/multiplicative-principle.md +++ b/notes/combinatorics/multiplicative-principle.md @@ -33,7 +33,7 @@ END%% Cloze {`union`} is to the additive property whereas {`struct`} is to the multiplicative property. Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). -Tags: c +Tags: c17 END%% @@ -42,7 +42,7 @@ Basic Which C construct corresponds to the multiplicative property? Back: `struct` Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). -Tags: c +Tags: c17 END%% diff --git a/notes/gawk/index.md b/notes/gawk/index.md index d847fa7..cbe80a4 100644 --- a/notes/gawk/index.md +++ b/notes/gawk/index.md @@ -310,7 +310,7 @@ END%% ## Exit Status -On success, `gawk` exits with status code `EXIT_SUCCESS`. On failure, with status code `EXIT_FAILURE`. On fatal error, `gawk` exists with status code `2`. #c +On success, `gawk` exits with status code `EXIT_SUCCESS`. On failure, with status code `EXIT_FAILURE`. On fatal error, `gawk` exists with status code `2`. #c17 You can specify a custom exit status by using the `exit` statement from within the `awk` program. diff --git a/notes/logic/boolean-algebra.md b/notes/logic/boolean-algebra.md index 8041e60..33cb106 100644 --- a/notes/logic/boolean-algebra.md +++ b/notes/logic/boolean-algebra.md @@ -48,7 +48,7 @@ Basic What C logical operator corresponds to $\neg$? Back: `!` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% @@ -57,7 +57,7 @@ Basic What C logical operator corresponds to $\land$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% @@ -66,7 +66,7 @@ Basic What C logical operator corresponds to $\lor$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% @@ -75,7 +75,7 @@ Basic What C logical operator corresponds to $\Rightarrow$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% @@ -84,7 +84,7 @@ Basic What C logical operator corresponds to $\Leftrightarrow$? Back: `==` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% diff --git a/notes/logic/equiv-trans.md b/notes/logic/equiv-trans.md index 151ac7e..fa3ec43 100644 --- a/notes/logic/equiv-trans.md +++ b/notes/logic/equiv-trans.md @@ -855,8 +855,16 @@ END%% %%ANKI Basic -How can we write an expression equivalent to $s(E_e^x)$ that doesn't use textual substitution? -Back: Write $s'(E)$ where $s' = (s; x{:}e)$. +If $s' = (s; x{:}s(e))$, then $s'(E) = s(E_e^x)$. Why do we not say $s' = (s; x{:}e)$ instead? +Back: The value of a state's identifier must always be a constant proposition. +Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. + +END%% + +%%ANKI +Basic +How do define $s'$ such that $s(E_e^x) = s'(E)$? +Back: $s' = (s; x{:}s(e))$. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. END%% diff --git a/notes/logic/propositional.md b/notes/logic/propositional.md index 3600029..99b2680 100644 --- a/notes/logic/propositional.md +++ b/notes/logic/propositional.md @@ -172,7 +172,7 @@ END%% %%ANKI Basic -Which of *if*/*only if* map to *necessary*? +Which of *if* or *only if* map to *necessary*? Back: *if* Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). @@ -180,7 +180,7 @@ END%% %%ANKI Basic -Which of *if*/*only if* map to *sufficient*? +Which of *if* or *only if* map to *sufficient*? Back: *only if* Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). diff --git a/notes/logic/short-circuit.md b/notes/logic/short-circuit.md index ce54229..2daea41 100644 --- a/notes/logic/short-circuit.md +++ b/notes/logic/short-circuit.md @@ -23,7 +23,7 @@ Basic What C operator corresponds to $\textbf{cand}$? Back: `&&` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%% @@ -56,7 +56,7 @@ Basic What C operator corresponds to $\textbf{cor}$? Back: `||` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. -Tags: c +Tags: c17 END%%