Lecture 1

Self-Evaluating Expressions

Numbers are the simplest expressions in our Beginner Student Language. Write an expression containing (and only containing) the number 211212.

Basic Summations

Write a formula to compute the sum of 2 and 3 where the first argument is 2 and the second argument is 3. Be sure to wrap the formula in parentheses to show that it is a function application.

Basic Products

Write a formula to compute the product of 77 and 101 where the first argument is 77 and the second argument is 101. Be sure to wrap the formula in parentheses to show that it is a function application.

Nested Formulas

Write a formula to multiply 10 by the sum of the numbers 123 and 456.

Order of Operands

Sometimes, the order of arguments is important. With addition and multiplication, the order that we set the numbers is largely not an issue. Subtraction, on the other hand, produces different results when arguments are flipped! Write a formula to compute the difference of 783 and 149.

Operations Receiving Arguments

Some operations do different things when given different numbers of arguments. For instance, when - receives only one argument, it negates its value. Write a parenthesized formula, using -, to negate 321.

Comments

Comments are for humans to read---they give explanations about data and code. Comments are prefaced by a semicolon ;. Comments are ignored by the program. Write a comment (or multiple) inside the box below.

Scaling and Overlaying Images

Copy an image from the Internet, and use the 2htdp/image library to "frame it inside itself". For example, if the image you downloaded looks like this:


then make an image that looks like this

appear in the Interactions Window when you hit the Run button. The inner image should be 70% as wide and 70% as tall as the original image. This website requires you to use the image-url function. In DrRacket, you can simply drag the image into the editor. Hint: use scale and overlay.