Lab 1

Goals:

1. Be able to write a simple procedure in Scheme.

2. Learn how to submit procedure definitions for automated PASS/FAIL evaluation.

Experiment:

For this lab, you will define a procedure named fermat (named after a famous mathematician) that computes the square root of the sum of the squares of two numbers. For example, these procedure calls will return the indicated values:
(fermat 3 4) --> 5
(fermat 5 12) --> 13

You will need to use one of Scheme's primitive procedures, sqrt, and the arithmetic operators + and *. The procedure call (sqrt n) will return the square root of n. For example, (sqrt 4) returns 2 and (sqrt 2) returns 1.4142135623730951.

You may define fermat as a single stand-alone procedure or you may define it in terms of the square and sum-of-squares procedures defined in class. If you do the latter, you must type in the definitions of square and sum-of-squares as well because they are not built into Scheme. The order of the definitions is not important.

Submission

After defining fermat in DrScheme, checking its syntax, executing it and testing the procedure in the interaction window, and you are satisfied that the procedure definition is correct, save the definition to a file (use Save definition) on Strauss.

After you have tested your code and are satisfied that it works, submit your code to the testing facility. Paste your code to the Programs(s) textbox at this Internet location:

Automated Tester

You must also fill in your loginname for Udel.Edu. This will be used to uniquely identify you, but no email will be sent.

You must also select your lab section number and the number of the lab assignment in the menu boxes provided.

Be sure that the pasted program you submit contains all your definitions.

IMPORTANT! After you have pasted you submission into the Program(s) textbox, filled in the Email box and selected the Lab section and Lab assignment numbers, click on the Submit button to run the testing procedure. It will show you the code that you submitted and its evaluation. Click on the Confirm button to cause the testing program to make a record of your submission and its evaluation. This is especially important when the evaluation returns a PASS; without clicking on the Confirm button, there will be no record that you passed the lab. It is also important to click on the Confirm button when the testing program returns strange messages that either indicate that something serious has gone wrong with the testing program or that leave you clueless about what is wrong with your submission. Confirming these responses makes a record that the TA can examine to find out what is happening.

It you want to include any comments, they must be Scheme comments, that is, each line of comment must begin with a semi-colon.

After you submit your Scheme definition to the TA in this manner, it will be automatically tested and you will get a reply returning either PASS or FAIL. When you get PASS and have clicked on the Confirm button, you have completed the lab assignment.

CAUTIONS!

1. The procedure name must be fermat and no other name. This is because only the procedure fermat will be called by the test program. If you misspell this name or otherwise fail to provide a definition for it, you may get back a message that says nothing, neither PASS nor FAIL.

2. Do not let any lines of the code you paste in be too long. If any lines get wrapped around, it may produce unacceptible syntax when loaded in Scheme. This is especially true of comments.