ex1.pdf

Design & Implementation of Programming Languages
First Exercise – Basic concepts of Scheme
Due by: Monday, 25 Mehr (23:59)
If you missed the TA class, some of the material covered is uploaded as an .rkt file; also, you may try the
tutorial at http://docs.racket-lang.org/quick/index.html , which should bring you up to speed.
1. Define a function in Scheme that works like this:
The first argument is the number of iterations and the second argument is the total length of
the image in pixels.
You will find the following reference handy, in order to obtain more information on the
slideshow library which will contain functions that will help you,
http://docs.racket-lang.org/slideshow/index.html
Some I used were:
a. (rotate img radians)
b. (hb-append [distance] img1 img2 …)
c. (cb-superimpose img1 img2 …)
d. (hline height width)
Of course, your solution may differ from mine.
2. Create a function that works like this:
img
(recurse img)
Of course, your solution is not allowed to recurse infinitely. To read an image from a file, use
something like:
(define img (bitmap "C:\\users\\darioush\\desktop\\img.jpg"))
Your function should be called recurse and receive 1 argument (this image).
Some useful functions may include:
a. (scale img scale)
b. (pin-over background-image dx dy image)
(Yes, the Internets have reached the level of maturity to design homework)
For your convenience, the image will be uploaded to the course website resources.
Please only submit 1 single file, which you have named studentid.rkt
Homework should be mailed to me at [email protected] (don’t forget the +pl1 part).
No code sharing is allowed, and violations of this policy will result in you receiving no credit for any of
your homework. There is also a no-late policy, which basically means homework received late will be
ignored. Please try to keep your code readable by using appropriate concepts like local definitions when
appropriate.
Do not hesitate to mail me or other TAs for questions; however, note that we will not debug your code.