Start DrScheme. Make sure that the language level is set to "Beginning Student" (Note: if you change the language level, it will not take effect until you hit the "Run" button).
Exercise 1: Experiment using DrScheme's Interactions Window as a calculator. See what operations you can use to calculate. Make sure to try big numbers and fractions. [3 min]
Exercise 2: Design a function that when given an integer that represents distance in miles will return the time (in hours) it takes to travel that distance when going 60 MPH. Write your function in the Definition Window, click Run, then use the Interactions Window to test your function. [5 mins]
Exercise 3: Design a function that given an integer representing time (in minutes) will return the distance traveled when going 70 MPH, rounding up to whole miles. [15 mins]
Hint: DrScheme comes with a help system called Help Desk. Open the Help Desk and click "Manuals", then click "Beginning Student". You will get 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.
Exercise 4: There are three kinds of errors you can make when writing a program in DrScheme. Come up with examples of each and try them out. Examine any error messages you get back. [5 mins]
Load the "universe.ss" teachpack in DrScheme. teachpack to DrScheme. In the menubar, click "Language" then "Add Teachpack...". A file selector window should popup. From the left side, select "universe.ss". Press "ok" and then press the "Run" button. The teachpack should be listed in the preamble of the Interactions Window.
Teachpacks come with documentation. In the Help Desk, search for "universe.ss". Also have a look at the documentation of the image.ss teachpack titled "Images (image.ss)".
Exercise 5: 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 6: Use
empty-scene to create scenes with your image.
Exercise 7: Create rectangles with the following dimensions
Exercise 8: Design the function
that given an index will return the corresponding rectangle,
(rec-sequence 2) returns a rectangle of size 20
Using the "universe.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 update or create a new world, which becomes the current world. The teachpack can use another of your functions to create an image of your world.
;; World is a positive number (current time)
;; World -> World ;; calculates the next world (increments the time) (define (next-world w) (add1 w))
;; World -> Image ;; draw the image for snapshot time w in the middle ;; of a 200x200 scene (define (world-draw w) (place-image (circle w 'solid 'black) 100 100 (empty-scene 200 200)))
big-bangin Help Desk).
;; We start at time 1, use next-world to update the world at each ;; tick, and use world-draw to render the world as a scene: (big-bang 1 (on-tick next-world) (on-draw world-draw))
Exercise 9: Change the animation above so that instead of growing larger, the disk moves across the canvas. Try left to right (x), top to bottom (y) and diagonal (both x and y).
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.