This lab explores the definition of record-based structures. It is a short lab.
Image CC-BY jonasj @ Flickr.
CMPSC 220 - Allegheny College - Spring 2010
This lab explores the definition of record-based structures. It is a short lab.
Image CC-BY jonasj @ Flickr.
Before we tackle lists, we'll get used to simply building and and manipulating structured data. Remember to follow the Design Recipe for structures.
(time-diff (make-pit 1 2 3) (make-pit 4 5 6)) 'tie if the scores were equal.
In each case, remember to provide a clear comment regarding the structure along with its definition.
For each of these functions, I would like you to follow the design recipe and have small tests written before you write the functions themselves. You should write tests that you are confident exercise all of your code.
For example, if I was writing the function
(define (add a b) (+ a b))
then I would write, before writing the function:
;; CONTRACT ;; add : number number -> number (= (add 3 5) 8) (= (add 0 0) 0)
and so on. You should have already encountered the design recipe in your reading of HtDP. I'll mention it at the start of lab again.
1930 - 2002
Edsger Dijkestra is a founder of our discipline. By "a founder," I mean he wrote some of the first languages, compilers, and algorithms we know and use daily.
One of his most cited pieces is the manuscript A Case against the GO-TO Statement. It was published by the ACM in 1968 under the title Go-to Statement Considered Harmful. Many of the citations simply reference the title, and not the content of the paper. If you wish to read more of his writings, you will find the Dijkestra Archive at UT Austin invaluable.
Consider Dijkestra's (original) manuscript in light of program and language design. Is his message still relevant to us in 2009? In what way? Why? Use your experience with languages like Java, Python, and occam-π, and consider his arguments in light of your experiences to date with a variety of programming languages. (2-3 pages)
I had 2 goals in assigning this first laboratory.
If you would please rate this laboratory based on these goals, and provide whatever feedback you feel is necessary to improve this lab in the future, that would be excellent.
This work is licensed under a CC BY-SA 3.0 License.