"Corruptisima republica plurimae leges." (The more corrupt the state, the more numerous the laws.) --Tacitus, Anals III 27 syntactic sugar leads to cancer of the semicolon. --Alan Perlis stay in tune with style of language. Predicates return #t or #f, not UH-YUPPER-GOMER or NO-SIR! or even YES or NO. IF nested IFs AND, OR - short circuit - special forms. semantics just like C could always do without - therefore "syntactic sugar" see later, way to define these at user level COND test: (if 0 12 15) ? example: democrat won election? country was at war? tax rate table (these could be done with tables instead - see how later) ---------------------------------------------------------------- PS1 solutions: Extra Credit Almost no one got this. PARANOIA is an important quality to cultivate if you want to be a good programmer. appeal to eminent authority is not a good way to verify the correctness of a computer program! Self-consistency is one way to check. But must be the right kind of consistency. Checking sin(x) via consistency w/ cos(x) is a bad idea: atomic failure can change both in a consistent fashion. Does output change properly as input is changed? For a numeric function, plot the output (or make a table). Does it look right? Get your fingers into those bits! (sin (+ 1 53890753489)) = (sin 5389075348)? Uh oh! Another is brute-force check against known case. last digit of 2^n goes like this: 2 -> 4 -> 8 -> 6 -> 2 -> 4 -> 8 -> 6 -> ... hence can easily be verified by hand. cycle length 4. What would the cycle length be if we had fourteen fingers? Six! Twelve fingers? Three! Eighteen fingers? Two! Mathematics of the situation: 2^n mod 10 calculate 2^n mod 5 and 2^n mod 2 for n>0, 2^n = 0 = 2 (mod 2) 2^(p-1) = 1 (mod p) for p prime [Fermat's little theorem, basis of modern public-key crypto] hence 2^4 = 1 (mod 5) hence 2^n = 2^(n-4) = 2^(n mod 4) (mod 5)