Start DrScheme. Make sure that the language level is set to "Beginning Student" (if you change the language level, it will not take effect until you hit the "Run" button).
Exercise 1: Experiment with using DrScheme's Interactions window as a calculator. See what operations you can use to calculate. Make sure to try big numbers and fractions. [1 min]
Exercise 2: Design a function that given an integer that represents time in hours will return back the time in minutes. Use the interactions window to test your function. [3 mins]
Exercise 3: Design a function that given an integer, representing time in minutes will return back the time in hours rounding up to whole hours.
Hint: DrScheme comes with a help system called Help Desk. Open the Help Desk and click "Manuals", then click "Beginning Student". That gives you a reference for the Beginning Student language. You can also highlight the name of a function and press F1, this will search Help Desk for the highlighted text.
There are three kinds of errors you can make when writing a program in DrScheme. [17 mins]
Add the "world.ss" teachpack to DrScheme. In the menubar, click "Language" then "Add Teachpack...". A file selector window should popup. Navigate to the "htdp" directory, then to the file "world.ss". Press "ok" and then press the "Run" button. The teachpack should be listed in the Interactions window.
Teachpacks come with documentation. In the Help Desk, search for "world.ss".Also have a look at the documentation of the image.ss teachpack titled "Images (image.ss)".
Exercise 4: Download an image off the web and insert it
into your Definition window. Use define
to give
it a descriptive name. Examples: cars, boats, planes etc.
Exercise 5: Use place-image
and
empty-scene
to create scenes with your image.
Exercise 6: Create rectangles with the following dimensions
Exercise 7: Design the function rec-sequence
that
given an index within the series of rectangles will return the
corresponding rectangle at that index, e.g., (rec-sequence
2)
returns a rectangle of size 4 by 8.
Using the world.ss teachpack we can create animations. The teachpack allows you to model a world. Every time the clock ticks, the teachpack uses one of your functions to create a new world, which becomes the current world. The teachpack uses a second of your functions to create an image of your world.
;; World = Number (positive)
;; World -> World ;; calculates the next snapshot in the series (define (next-world w) (add1 w))
;; World -> Image ;; draw the image for snapshot no. w (define (world-draw w) (circle w 'solid 'black))
big-bang
in Help Desk).
;; canvas is 200 by 200, the clock ticks every .1 seconds ;; and we start at world no 1 (big-bang 200 200 .1 1)
on-tick-event
in Help Desk).
;; every clock tick, gets the next snapshot number (on-tick-event next-world)
on-redraw
in Help Desk).
;; on-redraw play the world's image on the screen (on-redraw world-draw)
Exercise 9: Change the animation above so that the disk moves across the canvas. Try left to right, top to bottom and diagonal.
Exercise 10: Read the documentation of the image.ss teachpack and create an image of a car using circles and rectangles.
Exercise 11: Use the car image from Exercise 10 and create an animation with the car moving across the canvas.
Each of you will have a blue book. You will record in this book your partners information (name, email, IM, telephone no.) as well as the dates and times that you meet with your partner. At each meeting, you will agree to a next meeting recording the time and place. You should always carry the blue book with you. You might be asked to show your blue books at any time during the semester.