CSC151.01 2006S, Class 39: Association Lists and Searching Admin: * Due: HW12. * Assigned: HW13. * Remember: There's a homework due every Tuesday and every Friday * Reading: Searching. * Don't forget Thurday's Thursday Extra on the GIMP. Noon. Free Pizza. * Don't forget to vote! * Extended office hours due to preregistration. Signup outside office. Overview: * Databases and dictionaries. * Lists as dictionaries. * assoc, a procedure for searching lists. * Variants of Association Lists. * Lab. Databases are one of the primary applications of computers * A way of storing information * And categorizing that information * That supports searching/lookup based on categories Simplest database: Dictionary (or Encyclopedia :-) * Collection of Name/Value pairsa * Primary operation: "Look up name" * Often, the name is called a "key" How can we represent a dictionary in Scheme? * A list (or vector) of pairs * A list of lists * Assumption: The car of each element is the key Lab! /Reflection/ * It's amazing how many errors remain in labs. * What preconditions should assoc have? * What happens if the capitalization doesn't match (e.g., the desired key and the key in the list are the same, but capitalized differently)? * And what can we do about it? How do we support "look up by key"?