Why should we call other procedures if we can just do it ourselves?
What does this do?
(define (foo x) (x))
What are good mnemonics for first and butfirst?
What does (first (butfirst '(abc def ghi)) return and why?
What does (butlast (butfirst '(abc def ghi)) return and why?
Announcements
The goal of lecture is to review Common Confusions, give demos, introduce high-level information, and share announcements (NOT work on exam-level questions)
NOT to take dictation -- that's the purpose of handouts!! Eyes front, everyone...
I (Dan) strive to be a perfect (7.0/7.0) teacher -- how can I improve? Tell me!
You can go to ANYONE's lab (if there's room)
We have 3 other websites
ucwise : www.ucwise.org
bspace : bspace.berkeley.edu
WLA : wla.berkeley.edu
The course recorded is an earlier CS3 with slightly different emphasis. Early lectures may work better than later ones (we deviate later). Very different lab experience (they don't learn as well as you do, more information has to happen in lecture). Same book, though!
Dan's office hours: M10-11am in HFA C-30
Cheating - serious, don't do it, we'll send folks to the Office of Student Conduct
Giving away answers is as bad as receiving them
TAsiT = TAs-in-Training (top students [our readers] who are pre-TAs)
Homework 0 due in lecture now
No readers this year -- all files available online
Quest (half-way between a quiz and a test) scheduled in-class for 2009-02-09 ... in 1 week!
5% of total grade (basically, a sanity-check)
Open-book, open notes (as are all our exams)
Covers everything we've seen up to that date
There will be a review session the weekend before
Other admin questions?
Domain and Range
What happens when our function is +, our first argument is 1 and our second argument is two?
What is the domain of a function?
The things a function accepts as an argument.
What is the range of a function?
All the possible return values of a function
Examples: word sqrt sentence +
Abstraction
General Idea
Arguably the most important part of Computer Science
Definition: “The process of leaving out of consideration one or more properties of a complex object so at to attend to others”
How many of you know how to drive a car? How many of those know how a car works?
Functional Abstraction
You don’t need to know how code works as long as it adheres to specifications (domain, range, side-effects)
E.g.: double, whose body can be (* 2 x) or (+ x x))
This is the fundamental principle that allows for outsourcing!
E.g.: I give my detailed specs to some programmer in some other country where the cost of programmer labor is cheaper and they return me (hopefully nonbuggy) code.
Data Abstraction
You don’t need to know how we represent data internally, only how to manipulate it.
We can make up an Abstract Data Type (ADT), allowing us to create a new type of data (other than numbers, words, sentences, booleans and procedures, all you know about so far) and manipulate it.
Data Abstraction Example ... let's make a school!
What pieces make up a school?
Let’s make a first attempt to write the school data type...
(define (make-school name mascot)
(word name mascot))
Anything wrong? Let's write it again, correctly.
Now let's play with it and write has-same-mascot?
Now let's modify make-school to have a location too