II Introduction to Programming

    3 Basic Data

      3.1 Getting Started

        3.1.1 Motivating Example: Flags

        3.1.2 Numbers

        3.1.3 Expressions

        3.1.4 Terminology

        3.1.5 Strings

        3.1.6 Images

 Combining Images

 Making a Flag

        3.1.7 Stepping Back: Types, Errors, and Documentation

 Types and Contracts

 Format and Notation Errors

 Finding Other Functions: Documentation

      3.2 Naming Values

        3.2.1 The Definitions Pane

        3.2.2 Naming Values

 Names Versus Strings

 Expressions versus Statements

        3.2.3 The Program Directory

 Understanding the Run Button

        3.2.4 Using Names to Streamline Building Images

      3.3 From Repeated Expressions to Functions

        3.3.1 Example: Similar Flags

        3.3.2 Defining Functions

 How Functions Evaluate

 Type Annotations


        3.3.3 Functions Practice: Moon Weight

        3.3.4 Documenting Functions with Examples

        3.3.5 Functions Practice: Cost of pens

        3.3.6 Recap: Defining Functions

      3.4 Conditionals and Booleans

        3.4.1 Motivating Example: Shipping Costs

        3.4.2 Conditionals: Computations with Decisions

        3.4.3 Booleans

 Other Boolean Operations

 Combining Booleans

        3.4.4 Asking Multiple Questions

        3.4.5 Evaluating by Reducing Expressions

        3.4.6 Composing Functions

 How Function Compositions Evaluate

 Function Composition and the Directory

        3.4.7 Nested Conditionals

        3.4.8 Recap: Booleans and Conditionals

    4 Tabular Data

      4.1 Introduction to Tabular Data

        4.1.1 Creating Tabular Data

        4.1.2 Extracting Rows and Cell Values

        4.1.3 Functions over Rows

        4.1.4 Processing Rows

 Finding Rows

 Ordering Rows

 Adding New Columns

 Calculating New Column Values

        4.1.5 Examples for Table-Producing Functions

      4.2 Processing Tables

        4.2.1 Cleaning Data Tables

 Loading Data Tables

 Dealing with Missing Entries

 Normalizing Data

 Normalization, Systematically

   Using Programs to Detect Data Errors

        4.2.2 Task Plans

        4.2.3 Preparing Data Tables

 Creating bins

 Splitting Columns

        4.2.4 Managing and Naming Data Tables

        4.2.5 Visualizations and Plots

        4.2.6 Summary: Managing a Data Analysis

    5 Lists

      5.1 From Tables to Lists

        5.1.1 Basic Statistical Questions

        5.1.2 Extracting a Column from a Table

        5.1.3 Understanding Lists

 Lists as Anonymous Data

 Creating Literal Lists

        5.1.4 Operating on Lists

 Built-In Operations on Lists of Numbers

 Built-In Operations on Lists in General

 An Aside on Naming Conventions

 Getting Elements By Position

 Transforming Lists

 Recap: Summary of List Operations

        5.1.5 Lambda: Anonymous Functions

        5.1.6 Combining Lists and Tables

      5.2 Processing Lists

        5.2.1 Making Lists and Taking Them Apart

        5.2.2 Some Example Exercises

        5.2.3 Structural Problems with Scalar Answers

 my-len: Examples

 my-sum: Examples

 From Examples to Code

        5.2.4 Structural Problems that Transform Lists

 my-doubles: Examples and Code

 my-str-len: Examples and Code

        5.2.5 Structural Problems that Select from Lists

 my-pos-nums: Examples and Code

 my-alternating: Examples and Code

        5.2.6 Structural Problems Over Relaxed Domains

 my-max: Examples

 my-max: From Examples to Code

        5.2.7 More Structural Problems with Scalar Answers

 my-avg: Examples

        5.2.8 Structural Problems with Accumulators

 my-running-sum: First Attempt

 my-running-sum: Examples and Code

 my-alternating: Examples and Code

        5.2.9 Dealing with Multiple Answers

 uniq: Problem Setup

 uniq: Examples

 uniq: Code

 uniq: Reducing Computation

 uniq: Example and Code Variations

 uniq: Why Produce a List?

        5.2.10 Monomorphic Lists and Polymorphic Types

      5.3 Recursive Data

        5.3.1 Functions to Process Recursive Data

        5.3.2 A Template for Processing Recursive Data

    6 Structured Data

      6.1 Introduction to Structured Data

        6.1.1 Understanding the Kinds of Compound Data

 A First Peek at Structured Data

 A First Peek at Conditional Data

        6.1.2 Defining and Creating Structured and Conditional Data

 Defining and Creating Structured Data

 Annotations for Structured Data

 Defining and Creating Conditional Data

        6.1.3 Programming with Structured and Conditional Data

 Extracting Fields from Structured Data

 Telling Apart Variants of Conditional Data

 Processing Fields of Variants

      6.2 Collections of Structured Data

        6.2.1 Lists as Collective Data

        6.2.2 Sets as Collective Data

 Picking Elements from Sets

 Computing with Sets

        6.2.3 Combining Structured and Collective Data

        6.2.4 Data Design Problem: Representing Quizzes

    7 Trees

      7.1 Trees

        7.1.1 Data Design Problem – Ancestry Data

 Computing Genetic Parents from an Ancestry Table

 Computing Grandparents from an Ancestry Table

 Creating a Datatype for Ancestor Trees

        7.1.2 Programs to Process Ancestor Trees

        7.1.3 Summarizing How to Approach Tree Problems

        7.1.4 Study Questions

    8 Foundations: Bonus Materials

      8.1 Functions as Data

        8.1.1 A Little Calculus

        8.1.2 A Helpful Shorthand for Anonymous Functions

        8.1.3 Streams From Functions

        8.1.4 Combining Forces: Streams of Derivatives

      8.2 Queues from Lists

        8.2.1 Using a Wrapper Datatype

        8.2.2 Combining Answers

        8.2.3 Using a Picker

        8.2.4 Using Tuples

        8.2.5 A Picker Method

      8.3 Examples, Testing, and Program Checking

        8.3.1 From Examples to Tests

        8.3.2 More Refined Comparisons

        8.3.3 When Tests Fail

        8.3.4 Oracles for Testing