Values, Names, and Conversions

  1. Values, Types, and Supported Operations

    A type describes which operations a value supports and how those operations behave when applied.

    Undergraduate
  2. Integer Division and Fractional Quotients

    Choose a division operation from the intended quotient semantics and check its behavior at negative inputs.

    Undergraduate
  3. Quotient and Remainder Together

    A quotient counts complete groups and a remainder counts the leftover part under a particular division rule.

    Undergraduate
  4. Parsing Text and Formatting Values

    Parsing recovers a value from a representation. Formatting creates text for a particular reader or external interface.

    Undergraduate
  5. Lexicographic and Numeric Order

    Text order compares sequence elements from the start. Numeric order compares magnitudes after the values have been parsed.

    Undergraduate
  6. Unset, Empty, and Zero Values

    A missing input, an explicit zero, and an empty collection can carry different meanings even when a Boolean check treats them alike.

    Undergraduate
  7. Boolean Values and Truth Testing

    A conditional converts its test to a truth value. Be precise about which values the condition treats as meaningful.

    Undergraduate
  8. Object Identity and Value Equality

    Identity asks whether two references denote the same object. Equality asks whether the objects compare equal under their type's rule.

    Undergraduate
  9. Mutable and Immutable Values

    A mutation changes an existing object. Rebinding associates a name with another object and can leave older references intact.

    Undergraduate
  10. Shallow Copies of Containers

    A shallow copy duplicates the outer container and preserves the references held in its positions or entries.

    Undergraduate
  11. Sign and Absolute Value in Integer Calculations

    Absolute value measures distance from zero. Keeping the original sign can be essential for position, direction, or accounting.

    Undergraduate
  12. Fixed-Width and Arbitrary-Precision Integers

    Integer operations have different representable ranges across runtimes, formats, and hardware interfaces.

    Undergraduate
  13. Representing Decimal Amounts

    Store currency amounts in a representation whose scale and rounding rules match the operations the application promises.

    Undergraduate
  14. Binary Floating-Point Rounding

    A floating-point value stores a finite binary approximation to many familiar decimal fractions.

    Undergraduate
  15. Comparing Floating-Point Values with Tolerances

    A tolerance expresses how much difference a calculation or measurement can permit at the scale of the problem.

    Undergraduate
  16. Truncation, Floor, Ceiling, and Rounding

    Different ways of turning a fractional value into an integer behave differently at negative numbers and halfway cases.

    Undergraduate
  17. Implicit and Explicit Type Conversion

    An implicit conversion happens while evaluating an operation. Explicit conversion can make the intended representation and failure mode easier to see.

    Undergraduate
  18. Strings, Bytes, and Text Encoding

    A string holds text according to the language's character model. Encoding produces bytes that files and networks can carry.

    Undergraduate
  19. Sentinel Values for Missing Data

    A sentinel marks an exceptional condition in a value channel such as the absence of an optional argument.

    Undergraduate
  20. Unpacking Values and Simultaneous Assignment

    Unpacking binds multiple targets from one iterable. Computing the right side first lets a pair of bindings be swapped without a temporary name.

    Undergraduate
  21. Operators on Different Types

    Operator overloading gives one spelling several meanings determined by the participating types and their agreed operations.

    Undergraduate
  22. Hashable Values and Collection Keys

    Hash tables use a hash to locate candidate keys and equality to decide which key is present.

    Undergraduate
  23. Parsing and Domain Validation

    A parser can accept the spelling of a value while the surrounding application still rejects its meaning.

    Undergraduate
  24. Converting Input Records to Typed Values

    Translate incoming fields into domain values at one clear boundary so downstream code can use a consistent representation.

    Undergraduate
  25. Tuples and Mutable Contents

    A tuple's element positions stay fixed. The objects in those positions can still change when they support mutation.

    Undergraduate
  26. Representing Values with Units

    Keep the scale attached to a value so conversions happen once, at a documented interface.

    Undergraduate
  27. Canonicalizing Text Labels

    A canonicalization rule maps equivalent labels to one representation so records can be compared and grouped consistently.

    Undergraduate
  28. Propagating a Missing Value Through a Calculation

    A calculation should make clear whether incomplete inputs cause an unknown result, a partial result, or a documented substitution.

    Undergraduate
  29. Ratios, Percentages, and Fractional Rates

    Represent a percentage with an explicit scale so a calculation and its display cannot accidentally multiply or divide by one hundred twice.

    Undergraduate
  30. Deciding What Makes Records Equal

    Record identity and attribute equality are domain choices. Two records can represent one entity while containing different versions of its fields.

    Undergraduate