CMPU-101-54 Computer Science I and Lab. (Spring 2019)

Problems and Solutions

Lab. Descriptions

Lab. 00

Friday, 25th January, 2019

This lab. is intended to help you set up your Vassar CS department Linux account, get used to using DrRacket (the program we use to work in Scheme), and to let you try out saving some work to disc and then loading it back into the computer and running it again.

Problems for Lab. 00.

Lab. 01

Friday, 1st February, 2019

In this lab. you will be getting lots of practice using the printf statements, as well as using define to create functions. You will also get your first chance to submit your work using the submit101 command.

Problems for Lab. 01.

Lab. 02

Friday, 8th February, 2019

This lab explores using IF and COND to make decisions. You will also use a new built-in function, RANDOM, which lets the computer pick a random number. You will also begin to use the asmt-helper.txt file, if you haven't already done so.

Problems for Lab. 02.

Lab. 03

Friday, 15th February, 2019

This lab. is all about recursion and writing functions that call themselves to perform a task. This is an important and integral part of Scheme, and of computer science in general. There are also some problems involving the conditionals if and cond.

Problems for Lab. 03

Lab. 04

Friday, 22nd February, 2019

We have been looking at several different subjects of late:

  • recursion;
  • conditional expressions using if and cond;
  • the boolean operators AND, OR and NOT;
  • writing predicate functions, with or without conditionals.

This lab. is intended to give you some practice with writing predicate functions and using boolean operators.

Problems for Lab. 04

Lab. 05

Friday, 1st March, 2019

Manipulating non-empty lists is one of the most common operations in Scheme. We have seen how we can use the list operators first, rest and cons to access parts of a list and to stitch lists back together – or maybe even create new ones.

This lab. is intended to give you some practice using lists and list-based recursion, and to support you in solving the problems in this week's assignment.

Problems for Lab. 05

Lab. 06

Friday, 29th March, 2019

This lab. will give you some more practice with list recursion. You will also practice re-writing non-tail-recursive functions as tail-recursive functions, as well as working with accumulators.

Problems for Lab. 06

Lab. 07

Friday, 5th April, 2019

For the past couple of weeks we have been playing with accumulators, wrapper functions and list recursion. This lab. is intended to wrap up the topic with a few final problems, including working through hierarchical lists – i.e. lists which contain lists. There is even a bonus question…

Problems for Lab. 07

Lab. 08

Friday, 12th April, 2019

This week we have been working on local environments and variables, using let, let* and letrec. This lab. gives you the chance to practice with these expressions, in part by revisiting problems you have already seen and rewriting them.

Problems for Lab. 08

Lab. 09

Friday, 19th April, 2019

There have been many changes lately. Moving to using let and let* to handle variables, and writing self-contained recursive functions with letrec. Now we can use iteration to solve problems, with the loop control functions while and dotimes, though we need to set! our own variables now. Ah, the vicissitudes of destructive programming…

Problems for Lab. 09

Lab. 10

We have reached the end of this exploration of ideas of computer science, with two new ways of storing information: the vector and the concept of the data structure. In this lab. we will revisit a couple of old problems to see how we can recreate them using vectors, and then explore the connections between data structures, Scheme, and poker…

Problems for Lab. 10

Lab. 11 (Bonus Lab.)

There are many interesting computations which can be done in mathematics. Some we have seen in class: the Fibonacci series and the Ackermann function, for example, but there are many more. Computers can help us with the vast majority of them. One of my favourites is the idea of the 'happy number': a number is happy if… Well, read the lab. instructions and find out what makes a number happy – or not.

This lab. is 100% optional. It is worth 3 bonus lab. points.

Problems for Lab. 11