CS135 Final: The Design Recipe Introduction and template for the design recipe (with examples), conditional statements, "and" & "or" operators, and strings/symbols

184 views3 pages

Document Summary

Every program is an act of communication: between you and the computer, between you and yourself in the future, between you and others. Programs should be: compatible, composeable, correct, durable, efficient, extensible, flexible, maintainable, portable, readable, reliable, reusable, scalable, useable, and useful. Contract: describes what type of arguments the function consumes and what type of value it produces. Purpose: describes what the function is to compute (comments) Definition: the scheme definition (header and body) of the function. Tests: a representative set of inputs and expected outputs. Ex) we"ll write a function which squares two numbers and sums the results. ;; purpose: produces sum of squares of arg1 and arg2. ;; examples: (check-expect (sum-of-squares 3 4) 25) (check-expect (sum-of-squares 0 2. 5) 6. 25) (define (sum-of-squares arg1 arg2) (+ (* arg1 arg1) (* arg2 arg2))) A function which tests whether two numbers x and y are equal, and has two possible. Comparison functions consume two numbers and produce a boolean value:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions