Every programming language comes with a language of data and a language of operations on data.
Define one function per task.
All events are processed in order; if two events seem to happen at the same time, DrRacket acts as a tie-breaker and arranges them in some order.
The column below cw1 shows how cw2 is generated, depending on what kind of event e1 takes place.
cw1 is the result of (ke-h cw0 "a");
cw2 is the result of (tock cw1); and
cw3 is the result of (me-h cw2 90 100 "button-down").
Of course, big-bang does not touch the current state; it merely safeguards it and passes it to event handlers and other functions when needed.
On the other hand, it is critical to learn how to get from a problem statement to a program. We need to determine what is relevant in the problem statement and what can be ignored. We need to tease out what the program consumes, what it produces, and how it relates inputs to outputs.
A good program comes with a short write-up that explains what it does, what inputs it expects, and what it produces.
Ideally, it also comes with some assurance that it actually works.
Information and Data The purpose of a program is to describe a computational process that consumes some information and produces new information.
A data definition serves two purposes. First, it names a collection of data—a class—using a meaningful word.
Second,Computing scientists use “class” to mean something like a “mathematical set.” it informs readers how to create elements of this class and how to decide whether some arbitrary piece of data belongs to the collection.
So far, you have encountered the names of four classes of data: Number, String, Image, and Boolean.
With that, formulating a new data definition means nothing more than introducing a new name for an existing form of data, say, “temperature” for numbers
Express how you wish to represent information as data. A one-line comment suffices
Write down a signature, a statement of purpose, and a function header
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.