CS115 Study Guide - Final Guide: Natural Number, Euclidean Geometry, Ada Lovelace

61 views10 pages
elliehaj0807 and 36989 others unlocked
CS115 Full Course Notes
13
CS115 Full Course Notes
Verified Note
13 documents

Document Summary

Textbook: how to design programs (first edition), http://www. htdp. org. Canonical substitutions (used in stepping): functions are applied to values (not constants, when there is a choice of possible substitutions, always take the leftmost choice. * there is at most one choice of substitution. Purpose: describes what the function is to compute (i. e. what does it do) ;; (sum-of-squares n1 n2) produces the sum of the squares of n1 and n2. Contract: describes what type of arguments the function consumes and what type of value it produces. ;; requires: (any requirement you may have, you may not have any. ) ;; however, this does not restrict any inputs. ;; (i. e. you can say x > 0, but you can still put x = -5 as the argument) Examples: illustrating the typical use of the function. Definition: the racket definition of the function (header & body) (define (sum-of-squares n1 n2) (+ (sqr n2) (sqr n2) ) )

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