Finish Control Flow - Types




CS152

Chris Pollett

Nov 1, 2021

Outline

Introduction

Logically Controlled Loops

Recursion

Iteration/Recursion Equivalence Example

Implementing Recursion Efficiently

Scheme Tail Recursion Example

div class="slide">

Quiz

Which of the following statements is true?

  1. In Java, let doDothing be the method:
    void doDothing(int a, int b, int c, int d) {}
    
    the methods:
    void statementList1()
    {
       myFun1();
       myFun2();
       myFun3();
       myFun4();
    }
    
    and
    void statementList2()
    {
        doDothing(
           myFun1(),
           myFun2(),
           myFun3(),
           myFun4()
        );
    }
    
    would have the same effect.
  2. The assignments a[my_fun(i)] = a[my_fun(i)] + 1; and a[my_fun(i)] += 1; will always have the same effect.
  3. A Scheme continuation is the same thing as a lambda function.

Types

Type Systems

Type Checking and Related Concepts

Polymorphism