Thursday - Lecture 3 - Compound Functions
Date: June 25

The idea of compound functions is essentially a function within another function. Put more simply, it’s the idea that we can define our OWN functions. We do this through something called a lambda expression. Just as we can use (define netid "abc1234") to store the value of "abc1234" inside the name netid, we can store the value of a function inside a name like so:

(define add-1
  (lambda (x) (+ x 1)))

This means we can then call this function with inputs later on:

(add-1 1)

and Racket will look up the value of add-1 in its dictionary and then execute it with the input 1…eventually giving us 2!

Pretty cool.

After today’s videos you can complete the final problem of Exercise 1. One other new thing, to access the RKT files I use in the lecture recordings, click on the examples button below! If you’re on a Windows computer, you’ll need to extract the files from the ZIP folder before being able to edit them in DrRacket.


In-Class Resources


📊 Slides
🏸 RKT Examples
🎬 Available Videos 🎥
Link Title Type Duration
Video 1 Lecture 3.1 - Intro pre-recorded 3:41
Video 2 Lecture 3.2 - Special Forms pre-recorded 4:18
Video 3 Lecture 3.3 - Lambda Expressions pre-recorded 13:38
Video 4 Lecture 3.4 - Lambda Examples and the Substitution Method pre-recorded 248
Video 5 Lecture 3.5 - Making the row function pre-recorded 219
Video 6 Lecture 3.6 - Stack and Grid pre-recorded 342

Mini-Quiz 3: Compound Expressions

To take the mini-quiz associated with this lecture's content, you can use this link or find the quiz under the Quizzes page on Canvas.

2. Other Materials