CSC151 2007S, Class 08: Procedure Definitions Admin: * Due: HW 4 * Reading for Monday: Boolean values and Predicate procedures. * Yes, there's a new homework for Tuesday: Mad Libs. Overview: * Why define your own procedures? * How to define your own procedures. * Lab. /What/ * A procedure is a chunk of code * That has a name * That may have parameters * The chunk is often called the "body" /Why/ * Their instructor tells them to * Clarifies the program (+ (- b) (sqrt (- (sqr b) (* 4 a c)))) vs. (quadratic-root a b c) * Shortens the program when you do the same thign over and over again * Lets you (or someone else) figure out a solution, and then lets others use the solution * Permits you to focus (elsewhere) on the *what* not the *how* /How/ (define NAME (lambda (PARAMS) BODY)) (define increment (lambda (x) (+ x 1))) /Lab/ * 3c is a thought question * Do not document, unless told specifically to do so.