# CMPU-101-04 Computer Science I and Lab. (Fall 2018)

This calendar will evolve over the course of the semester. Typical entries will include links to the code we have studied in class, details of lab. problems and assignments, and sections of the textbook we covered in class.

#### FridayLab.

I
4th September

Welcome and Introduction.
6th September

Setting up a Computer Science (CS) department account.
Introduction to the drRacket program. Poking the computer & seeing what happens.
7th September

Creating directories with `mkdir`. Moving between directories with `cd`. Listing files with `ls`. Your first program in Scheme. Running, saving and loading a program.
II
11th September

Poking the computer (a second time). Data types. Evaluation of symbols to their definitions. The importance of parentheses. First explorations of Scheme's computational model.
Chapters 2, 3, 4 and 5.
13th September

Reviewing data types. Review of Scheme's computational model ('evaluate and apply'). The output of a function. The `printf` command and side-effect printing. Line breaks and substituting into printed text. What `lambda` does.
Code from class
14th September
III
18th September

Using predicates to answer yes/no questions. Arithmetic predicates. The multipurpose `eq?` function. Shielding a datum from evaluation using the `quote` function, and its abbreviation. Beginning conditionals and the `if` statement.
Code from class
20th September

A brief review of `if`. Using `cond` for more complex situations, including the use of `else`. Contracts, how to write them and why they are important.
Code from class
21st September
IV
25th September

Introducing recursion. Infinite loops and how to avoid them. The `factorial` function (take 1).
Code from class
27th September

Recursion, part 2: the Fibonacci sequence.
Review Chapter 12.
Code from class
28th September
V
2nd October

Return of conditionals. Introducing boolean operators `and`, `or` and `not`, and their "truth tables".
Code from class
4th October

Review of boolean operators and "truth tables". Review of predicates. Writing predicates without `if` or `cond`. Introducing non-empty lists. `first` and `rest`.
Code from class
5th October
VI
9th October

Review of how `if` and `cond` can be interchanged with `and` and `or`. Constructing lists with `cons`.
Code from class
11th October
MIDTERM REVIEW.
Please bring questions & subjects to review.
12th October

#### AUTUMN BREAK

##### Happy holidays! :-)
VII
23rd October
Individual Reviews.
25th October

The Default Rule, formally ('evaluate and apply'). Built-in functions vs. Special Forms; how special forms do not follow the Default Rule. The built-in `eval` function & how drRacket applies it at each step.
26th October

Introducing tail recursion and accumulators. The 'function box' as an analogy for drRacket's processing of code. Wrapper functions and writing contracts for them.
Code from class
VIII
30th October

Brief review of accumulators and wrapper functions. Returning to lists and list recursion.

Starting from a single, simple function and an idea. Adding small improvements to our code as our ideas change.

Code from class
1st November

List recursion continued. Passing a function as an input to a function. Mapping: applying the same function to every element in a list. Skipping items in lists.
Code from class
2nd November
IX
6th November

Nested lists. How to recursively explore nested lists.

Adding help for the player, and how it requires us to change `if` to `cond`. Adding a variable to store the player's guess in two ways: first with `define` and then by using another wrapper function.

Code from class
8th November

Local environments. (And multicoloured candy apples.) The `let` special form: syntax and evaluation, and its similarities to functions using `lambda`. The `let*` special form.
Code from class
9th November
X
13th November

Review of list operations with `cons`. Review of `let` and `let*`. Defining recursive local functions with `letrec*`.

First look at the `set!` function.

Code from class
15th November

Destructive programming. Changing the values of variables with `set!`. The `while` function, which lets us loop any number of times. The `dotimes` function, which loops a fixed number of times.
Code from class
16th November
XI
20th November

Review of loops using `dotimes`. Using the counting variable of an outer loop as input to the counting variable of an inner loop. The `when` special form. Comparing `when` against `if` and `cond`.
Code from class
22nd & 23rd November
No class!
Happy Thanksgiving!
XII
27th November

Organising data using structures. The `define-struct` special form, and the special forms it creates to help us use structures.
Chapter 19.
Code from class
29th November

Storing data using vectors. Mutable and immutable vectors. Creating mutable vectors with `make-vector` and immutable vectors with `#(...)`. `vector-ref` and `vector-set`.
Chapter 18.
Code from class
30th November
XIII
4th December
6th December
7th December

#### IN-CLASS FINAL

##### Focuses on material since midterm,but covers all material.
XIV
11th December (Thursday Schedule!)

Class

12th December (Friday Schedule!)

Lab.

14th December
No class!
End of classes :'-(