CSC151.02 2003F, Class 42: Association Lists Admin: * Homework: Tail recursion lab (including extra) * No reading this weekend * Extra credit for attending the Roots of Renewal concert (1/2 point) Overview: * Databases * Scheme's Association Lists * The assoc procedure * Useful variants * Lab Question: Who are the richest Americans? * Larry Ellison - Databases (Oracle) * Bill Gates - Dropping out of Harvard; Stealing/buying good software ideas * Warren Buffett - Buying good companies When we talk about computing, we should probably talk about Databases. What is a database? * An organized, possibly indexed, collection of information that eases analysis and retrieval * At the root of most databases is a simple idea: You can index information by a "key" * The key is the thing used to retrieve the information; it's the entry in the index The simplest form of database is the "dictionary" (also called a "keyed table") * A collection of keyed values. In Scheme, we can implement a dictionary as a list of lists. * The key of each member list is the car of that list * We call this structure "an association list" * Rather than writing your own "search" procedure, you can use assoc If Scheme did not provide assoc, we could implement it! We could therefore build interesting variants * Find all matching elements * Use a predicate rather than a key as the first parameter * Both [Hmm ... that's select] Do the lab!