teaching machines

CS 330: Lecture 34 – Call-by-name

Dear students, When you call a function, what happens? In particular, what happens in this code? int m() { cout << "m" << std::endl; return 5; } int r() { cout << "r" << std::endl; return 7; } int multiply(int a, int b) { cout << "*" << std::endl; return a * b; } int […]

Fixing Our Bugs

As a kid, I played many Japanese video games. In high school, I got a permanent release from study hall to teach myself Japanese in the computer lab. I chose the college I did because they offered Japanese courses. (At least they did at the time I applied. But they were cancelled before I got […]

CS 330: Lecture 33 – Closures Continued

Dear students, Last time we ended in the middle of a discussion about the dangers of closures oversharing values. We fixed the situation by adding a function to introduce a new scope for each closure so they wouldn’t clobber each others’ state. This situation happens frequently enough in Javascript that there’s a slightly simpler idiom […]

CS 330: Lecture 32 – Closures

Dear students, Let’s start with a Program This! Consider the foreach algorithm: for each item in list do something with that item (call a method, print, etc.) The core idea is that we have a list of items, and we want to produce some side effect for each of them. The foreach algorithm doesn’t return […]

CS 318: Lab 22 – Flexbox

Dear students, Today we hit up the new Flexbox system of CSS. In short, Flexbox allows us to control the distribution, alignment, order, and expansion of a bunch children within their parent. It replaces many of the hacks of float and Javascript to achieve certain layouts. We’re going to dive right into the lab today. […]

CS 330: Lecture 31 – HOFs and Lambdas in Java

Dear students, Is Haskell the only language that supports composition and higher-order functions? No. Does Java? It can be made to! Let’s do that today. We start by porting the . operator. What do you suppose the type signature of . is in Haskell? Well, it takes in two functions and gives back a new […]

CS 318: Project Prototype 2 – due May 9

Your next milestone in the project is to iterate on the first digital prototype of your site. You will present this second draft of your prototype to randomly assigned classmates for another round of evaluation. Task 1: Iteration on Your Prototype Create a second draft of your site in a folder named prototype2 in your […]

CS 318: Lab 21 – Peer Review

Dear students, Today is peer review day. You will examine three peers projects and give mostly anonymous written feedback. You will spend 15 minutes examining each site in detail. Look for functional issues, like these: Try to break it by resizing the window and locate weird interactions with links or menus. Are there broken links […]

CS 330: Lecture 30 – Haskell IO Continued

Dear students, Last time we introduced ourselves to Haskell’s world of purity and its world of side effects. We learned that any value that gets created in the world of side effects is packaged up in an IO wrapper using the return function. We can unpackage such wrappers using the <- operator. We will finish […]

Bad Star

If you are an illustrator, there are two things that are harder to draw than anything else. The first is lettering. Bless you, illustrators, if you have to draw a busy street scene with lots of storefronts full of signs and words. The second is stars. Most illustrators just give up on stars. They are […]

1 2 3