CS105-03 lecture notes - fall 98 Behfar Bastani following "simply scheme" by brian harvey & matt wright Week 1 --- lecture 1, 10/5/98 --------------------- * examples of simple procedure calls (+, first, butfirst, word) * some "types": numbers, words, letters * functions, their domain & range --- lecture 2, 10/7/98 --------------------- * review functions & dom/range * more examples, but using the "functions" package * booleans & sentences * every & keep, word & sentence --- lecture 3, 10/9/98 --------------------- * do a few "functions" package examples with every and keep as review, then leave "functions" package for good. * review: what is a type? -> a "kind of thing" types so far: numbers, letters, sentences, booleans, and *functions* * think of a function which: takes a word, return a boolean (english? , verb? , palindrome?) takes a word, returns a word (piglatin) takes a word, returns a sentence (anagrams) takes a sentence, returns a number (length) takes a number, returns a sentence (number-spell) takes a sentence and a function on words, returns a sentence (every, keep) takes a word and a sentence, returns boolean (member?) takes a function and another function, and returns a function (compose) * read/eval/print loop and evaluating expressions * atomic expressions are names standing for various values. scheme just "knows" the values of these. eg: numbers (are "self-evaluating"), functions (like +, first, etc) * compound expressions denote processes which result in a value. to evaluate these, we evaluate all sub-exps *first* (circular! the solution: it should eventually "bottom out", meaning get down to atomic expressions), and apply the left-most sub-exp (the function) to the remaining ones (the args)