CSC151 2009F, Class 06: Computing with Symbols and Numbers
Admin:
* Don't forget to fill out the RISC survey. It should take about
fifteen minutes. (It's really important to the College that you
take it.)
* EC: Women's Soccer Wednesday @ 5:30
* The quiz is graded and returned. See further info below.
* Are there other questions on the lab writeup or assignment?
Overview:
* Notes on the Quiz
* Notes on the Writeup and Assignment
* Types
* Kinds of Numbers
* The strange mod operation
* Lab
Notes on the Quiz
* Returned!
* I do not report any statistics about graded work.
* No, it's not that I'm too lazy to compute them.
* Since my grading is on an absolute scale, knowing the grades of your
colleagues does not help you.
* A also discourage you from discussing those grades with your colleagues.
* Some issues:
* On 2c: (string-append "Goodbye " name), name is undefined.
* So the interpreter will report an error
* On all of 2: (string-append ...) returns a string
* So the Scheme interpreter will put quotation marks around the
string to make it clear that it is a sgin.
Notes on the Lab Writeup
* General notes on lab writeups now available in the Handouts area.
* The other course may be doing different writeups than we are.
* For 2d, your goal is to think about what you should do differently if
you want to support different size canvases.
* A simple house (rectangle for the body, a shape of your choice for the
roof) is fine. Your goal is to get started, and to think about how you can
resize the house for different shape canvases.
Notes on the Assignment (Assignment 2)
* Start early, ask questions
* Don't bang your head against the wall
* Particularly after cutting off your afro
Types
* Lots of components of alogrithms
* Core: Basic values to work with
Operations to work on those values
* Obvious value: "The number"
* CS folks use the term "type" for "collection of values"
* Sometimes in terms of "this is in the collection, this is not"
* Scheme provides "membership procedures" (predicates) to test
membership in various type
* integer?
*Sometimes type is a restriction on what can be done with values
* The + operation can be applied to integers, reals, other numbers
* The string-append cannot be applied to integers, real, other numbers
* The string-append can be applied to strings
Kinds of Numbers
* One dimension: General class: integers, rationals, reals, complex
* Integers are 0, positibve whole numbers, negative whole numbers
* Whole numbers have no decimal component
* Integers have no remainder when you divide by one
(Provided you know division)
* A formal definition
0 is an integer
Suppose i is an integer, i+1 is an integer
Suppose i is an integer, -i is an integer
* ANother dimension: representation: Is it exact or approximated
The Mod Operation
Lab
* IMPORTANT! If you use a decimal point in the number, our interpreter
assumes you want an inexact number
* You can use slashes to write rational numbers.
Reflection
* "Inexact" is an awkward term. It means that it's using a representation
that *might* be inexact because of how the computation happened.
* Explain floor, ceiling, round, truncate
(round 3.5)
(round 4.5)
(round -3.5)
(round -4.5)
* For .5, round rounds to the nearest EVEN number, to be fair
* Modulo is a funky way of counting, and I should have talked more about
it