Programming Languages (CS302 2007S)
[Skip to Body]
Admin:
[Front Door]
[Glance]
[Handouts]
[Honesty]
Current:
[Current Outline]
[Current EBoard]
[Current Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Outlines]
[Readings]
[Reference]
[HOG]
Misc:
[SamR]
[CSC302 1999S]
[CSC302 2006S]
Assigned: Friday, February 9, 2007
Due: Friday, February 16, 2007
No extensions!
This homework is also available in PDF.
Summary: In this assignment, you will expand upon the ideas from the reading on representing images.
Purposes: To give you more experience understanding thinking about how we might represent images and about the relevance of the functional paradigm to that representation.
Expected Time: Two to three hours.
Collaboration: You may work alone or you may work in a group of size two or three. I encourage you to work in groups on this assignment. You may discuss the assignment with anyone you'd like, provided you cite such discussions in your assignment.
Submitting: Email me your answer. More details below.
Warning: So that this exercise is a learning assignment for everyone, I may spend class time publicly critiquing your work.
In the reading on representing images, you experienced a simple representation of drawings as lists of lists of points. While that representation provides an appropriate environment for exploring basic issues (particularly issues of higher-order programming), it is a bit limited as a way of representing images. In particular, it ignores some things that a designer might find useful, such as associating a line size or a color with each drawing. In addition, one might want to provide additional facilities, such as rotation.
Consider the following definition of drawings.
A drawing is either (1) a four element list consisting of (a) the symbol
drawing
, (b) a color, (c) a pen, and (d) a list of points;
or (2) a list of drawings.
Create the following procedures for working with drawings:
(primitive-drawing color pen pt1 pt2 ... ptn)
(combine-drawings drawing1 drawing2 ... drawingn)
(render img drawing)
(translate drawing delta-x delta-y)
(scale drawing scale-x scale-y)
(recolor color drawing)
Write a procedure, (rotate angle drawing)
,
that rotates the given drawing about the origin.
Correct, working, solutions will earn a check.
Particularly elegant solutions that take advantage of higher-order principles and that show evidence of refactoring are likely to receive a higher grade.
Non-working or incorrect solutions will earn a lower grade.
Please submit this via email, using a title of CSC302 HW4.
Attach the files that you've created to that email message.
[Skip to Body]
Admin:
[Front Door]
[Glance]
[Handouts]
[Honesty]
Current:
[Current Outline]
[Current EBoard]
[Current Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Outlines]
[Readings]
[Reference]
[HOG]
Misc:
[SamR]
[CSC302 1999S]
[CSC302 2006S]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Sun Apr 29 11:25:31 2007.
The source to the document was last modified on Thu Feb 8 21:04:24 2007.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS302/2007S/Homework/hw.04.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby