I.7 Semester I Review 7
Additional review exercises.
This page contains additional review exercises.
Basic Spanish
We will write a function to conjugate regular verbs “-ar” and “-er” verbs according to the following chart. Use the ending letters to decide how to categorize a given verb. We will only consider the present and past tense (preterit) of the verbs.
Verb | Subject | Past? | Result is base + | Example (“andar”/“correr”) |
---|---|---|---|---|
-ar | yo | false | -o | ando |
-ar | yo | true | -é | andé |
-ar | tu | false | -as | andas |
-ar | tu | true | -aste | andaste |
-er | yo | false | -o | corro |
-er | yo | true | -í | corrí |
-er | tu | false | -es | corres |
-er | tu | true | -iste | corriste |
Signature:
conjugar: string(verb-infinitive)
string(person)
boolean(past-tense?)
-> string
Example:
(check-expect (conjugar "correr" "tu" true)
"corriste")
Note: ignore accents.
Too much? Try the simplified, present tense only function:
Verb | Subject | Result is base + | Example (“andar”/“correr”) |
---|---|---|---|
-ar | yo | -o | ando |
-ar | tu | -as | andas |
-er | yo | -o | corro |
-er | tu | -es | corres |
Placed objects
An image-posn
is an image together with a posn.
draw-it: ip image(background) -> image
teleport: ip(shape1) ip(shape2) -> ip(new-shape1)
: Produce a newip
whose image is the same asshape1
but whose position is the same asshape2
. This has the effect of moving shape1 on top of shape2.- Make an animation that remembers two images with their positions.
- When you hit the “t” key, the first image teleports to the second image.
- When you click the mouse, the first image jumps to the mouse’s position.
- The second image slowly moves left and up from its original position, maybe 6 pixels every 0.5 seconds.