Home
 
211 S '05
General
Texts
Syllabus
Assignments
Communication
Blog
Labs
Ofc Hrs
Advice
Stories
Gallery
DrScheme

211 S '05 Blog

Important Messages from the Instructor

Syndicate this site (XML)

Thursday, April 21st, 2005 10:02:55am

If you didn't turn in your signed project analysis for the final homework, do so by Friday 4/22. I don't want to take off points for this, but I will if it's not turned in. If you didn't turn one in I will have sent you an email this morning.

Wednesday, April 13th, 2005 3:55:29pm

The final homework is due at the end of the day on 4/13, not 4:30pm.

Wednesday, April 13th, 2005 7:44:31am

I'll be around this afternoon for those who need help on your final homework. If you will be in the lab and need help please send me email, I can stop by. Also, Sarah has office hours today from 11am-1pm, so please see her with questions, too.

Wednesday, April 13th, 2005 7:20:31am

Because there was some confusion about what "end of the term" meant, revisions on the exam and the essay will not be required. You are encouraged to turn in a description of the problems you had on the exam, though; you may do this anytime. I had intended for you to turn the revisions in by today, but since some students were confused and I want you to focus on the project and I definitely don't want to give you work during finals, I will make the revisions optional.

Good luck on the project!


Tuesday, April 12th, 2005 9:56:13am

A reminder that before the end of this term you must turn in the following to receive credit for the final exam:
  1. exam corrections for the computer problms,
  2. and a 200-word-max essay on why the test was difficult for you
Sarah mailed all your original exam answers back to you, if you did not receive them mail both of us; we'll send them immediately. In particular, you must turn in exam solutions that run. If they do not run, you will not receive credit.

Monday, April 11th, 2005 11:15:25pm

The final project is due this Wednesday 4/13 at 4:30. You must email the program as well as turning in a hard copy in a box marked outside Jeff's office by this day.

Jeff will hold office hours from 1-3pm on Tuesday 4/12. Sarah will hold office hours from 11am-1pm on Wednesday 4/13.


Tuesday, April 5th, 2005 9:16:06am

We will do course evaluations at the end of class on Wednesday 4/6.

Monday, April 4th, 2005 11:05:33am

Sarah will hold office hours this Wednesday, 4/6, from 10am-12pm. I will hold my office hours that day from 1:30-3:30pm.

Sunday, April 3rd, 2005 10:59:13am

Please remember that you must turn in the initial design of your project by 4/7. Every design must include the following:
  • Data analysis: Data definitions and interpretations.
  • Functional analysis: You must decide the primary functions you'll use and write the contracts, purposes, and headers for these.
This should be not much longer than a page. This will force you to think hard about your design, and will help us focus designs that are too complex.

If you up with your own project idea, you must also include a description of you idea similar to those found on the web page in addition to the above design.


Monday, March 28th, 2005 6:56:59pm

As I said in class today, I was not pleased with the class's performance on the computerized portion of the midterm. Hence, everyone must turn in completed questions that run before the end of the year; email them to me.


Monday, March 28th, 2005 3:06:56pm

The exam has been graded and will be given back in class. Results are interesting. Also assignment 13 has been posted. This is very similar to last semester's final assignment and will be worth more points than a regular assignment. I'll talk about it briefly in class today.

Thursday, March 24th, 2005 3:32:55pm

I will out of town on April 7th, so we will not have class that day.

Wednesday, March 23rd, 2005 6:14:32pm

A student asked:
I was wondering if it was ok to have a printed out version of the Blog and examples that were put on the website. Thanks for your help.
I responded:
yep, that's fine. And I'll put that on the blog. Jeff

Wednesday, March 23rd, 2005 3:01:20pm

The exam will be tomorrow (3/24) in WVH 212, the computer lab. It will start promptly at 6:30pm, and you will have 3 hours. Those who require extra time will start at 5:00pm. The computers will not be plugged into the interne. You may bring your blue book and notes from this class. Either or both may be digital. If you wish to have your digital notes with you for the exam, you must email them to me before 3:00pm on 3/24. You may not bring notes from previous semesters or any other aids. If you have any questions about what you can bring into the exam, ask. If you are found to have notes from previous semesters or any material other than the blue book or notes and materials from this year during the exam you will receive a zero on the exam and be charged with academic dishonesty. You will also have to sign a sheet acknowledging this policy and show your ID to hand in your exam.

There will be a written part of the exam and a part of the exam to be completed on the computer. We will give precise instructions of how to hand in these parts at the exam. But, basically you will complete the written part, then complete the computer part. When you are finished you we will plug your computer back into the internet and submit the computer part. You will hand in your signed exam, showing your ID to the proctor, and be on your way.

There will be no lab the Friday after.


Tuesday, March 22nd, 2005 9:19:23am

Here is the derivative

Tuesday, March 22nd, 2005 9:17:59am

Here is the derivative example from class today.
der.ss
Note that I used structural recursion with an accumulator. Plus there is a special case in here. If you consider some examples:
polynomialderivativescheme polynomialscheme derivative
40(list 4)(list 0)
x + 31(list 1 3)(list 1)
x3 + 2x2 + 3x + 4 3x2 + 4x + 3 (list 1 2 3 4) (list 3 4 3)
So we use one function called der for handling the case were we can have just a constant and one function called der2 for handling the case that we have a term wih an exponent of at least 1.

Wednesday, March 16th, 2005 6:56:45pm

Here are the various versions of random number lists we talked about today:
randoms.ss
A couple things to note:
  1. I used a helper function to test two of these functions. This is a simple use of functional abstraction. One can note that in order to test a function that is produce a list of n distinct numbers, there are two things to test: (1) that there are n numbers, (2) they are all distinct. So, we want to test this every time, but have one function to do it.
  2. Secondly, I used local to define the accumulator function in the last example. This is an idiom. Essentially, the idiom is as follows: If you ever write an accumulator-style function do-something as:
    (define (do-something a1 a2 ... an)
      (do-something-acc a1 a2 ... an <base-case>))
    
    (define (do-something-acc a1 a2 ... an base-case) ... )
    
    you can usually write is as:
    (define (do-something a1 a2 ... an)
      (local ((define  (do-something-loop base-case)) ... )
        (do-something-loop <base-case>)))
    
    Because, if you see, the only change is that instead of passing a1, a2, ..., an as arguments to do-something-cc, you can make it a local, because do-something-loop already sees a1, a2, ..., an.

Wednesday, March 16th, 2005 6:30:15pm

Here is the code from today that we didn't get to:
Graph paths:graph.ss
Graph paths with an accumulator:graph-acc.ss
Guessing:guess.ss
The first just finds path from two nodes in a graph; we discussed this in class previously. But this one has the small change that we determined if there is a path, but we're not concerned what it actually is. This raises a problem, as we'll see tomorrow, when there are loops in the graph; and this is solved in the second program. The last one simulates a guessing game. The idea is that guess takes an oracle who tells whether the answer is correct, higher, or lower than the current guess, n. The method for guessing is that, at every step, we choose the next guess based on the previous guess and what the oracle tells us. If we guess a number that is higher than the correct answer and our last guess was higher, we'll choose a number right in the middle of the guessed number and lowest. If the last guess was lower, we'll choose a number right in the middle of the last number and the new guess. Therefor, we accumulate the last guess in last. Using the method one can guess a secret number in a finite number of tries, depending on the range. Here, the range is 0 to 100. So, the number of guesses is O(f(r)) for a range r. One way of guess the function f, is to run this program many times on many ranges. But in order to do this you need to determine how many guesses were made. So one task (exercise) is to right a new function based on guess
;; guess-tally: (Number -> Answer) Number -> Number
;; returns the number of guesses used is guessing p's number starting
;; with n
(define (guess-tally p n) ... )

Tuesday, March 15th, 2005 7:02:37am

Here's the start of our randoms program... try to finish it.
;; randoms: Number -> (listof Number)
;; returns a list of n random unique numbers
(define (randoms n)
  (randoms-acc n ...))

;; randoms-acc: Number (listof Number) -> (listof Number)
;; produces a list of n random numbers, and accumulates
;; the result in acc
(define (randoms-acc n acc)
  (cond
    [(= n (length acc)) ...]
    [else (cons (random n) (randoms-acc (- n 1) ...))]))
And here is the code for the graph traversal we did in class:
find-route.scm

Monday, March 14th, 2005 11:25:17am

Here (world-example.ss) is an example of using the world.ss teachpack. You should first read the help documentation, then look at this example. We want to define a world that contains a rocket. World-passing style is a way of programming where that we use to represent the world. In particular we need a definition of the world. So we define the world as a union.
;; Data Def:
;; World is one of
;; -- false
;; -- positive number
;; Interpretation:
;; -- false means the rocket hasn't been launched
;; -- number n means the rocket has been 
;;    launched and has reached height n
The way this teachpack works is as follows: We will call big-bang and tell it how big the world should be and how often to update it. In our example we have decided to update the world every 0.1 seconds. So, every 0.1 seconds this teachpack will look for a function that we have passed to on-tick-event, and this function should consume a World and produce an updated World. So, we need to define a function, we'll call it tock that consumes a World and returns a new world. For our world our new world will be a new world that contains a rocket that moved a little. We will use the special form:
(update (world-draw w) produce (world-move w)))
to define a function tock. This function will update the world on every tick.
;; tock : World -> World
;; update the canvas and produce next world
(define (tock w)
  (update (world-draw w) produce (world-move w)))
Think of update as magic. The expression passed to updated will be evaluated on every tick to update our perception of the world; the expression to produce will be evaluated on every tick to produce a new world. One way to think of it isthat these (update ... produce ...) are linked. Supposed we start by passing a world called w0 to big-bang, then the calls to tock are linked in the following way:
The world we see:

           (update w0 produce w0)
                   |          |
     output  <-----*          |----------*
                              |          |
                              V          V
                      (update w1 produce w1)
                              |          |
                output  <-----*          |----------*
                                         |          |
                                         V          V
                                 (update w2 produce w2)
                                         |          |
                           output  <-----*          |----------*
                                                    |          |              
                                                    V          V
                                                    w3         w3
                                            ....
                                         wn         wn
                                         |          |
                           output  <-----*          |----------*
                                                    |          |
                                                    V          V
                                            (update wn produce wn)
This keeps going until we call end-of-time.

Friday, March 11th, 2005 7:07:22am

Here are the two examples from class yesterday:
Merge sort:mergesort.scm
Fractal:fractal.scm

Remeber, in structual recursion we recur over the shape of the input data. An example is the template for simple lists. In generative recursion we actually create new data on which to recur. Our examples yesterday were fractals and mergesort.

To explain this in another way, let's look at the English statements for the two.

Structual: For example, consider a function to add 1 to every item in a list of numbers.
;; add1*: (listof Number) -> (listof Number)
;; adds 1 to all in l
(define (add1* l)
  (cond
    [(empty? l) empty]
    [else (cons (add1 (first l)) (add1* (rest l)))]))
In English this says "if the input list is empty, return empty; otherwise add 1 to the first item and recursively process the rest of the list."
Generative: Take our merge sort example from class:
;; mergesort: (listof Number) -> (listof Number)
;; returns a sorted version of the input list
(define (mergesort lon)
  (cond
    [(<= (length lon) 1) lon]
    [else (merge (mergesort (firsthalf lon))
                 (mergesort (secondhalf lon)))]))
In English this says "if the length of the input list if 1 or 0 return the list -- it's sorted; otherwise break the list in two and recur on those."
Note that I've colored coded the English statements and the code. Red corresponds to the termination case, and blue corresponds to the recursive case. In every recursive function you write your must note and state the termination condition. Repeating every recursive function you write your must note and state the termination condition!!!! As a style note, this termination case will usually show up as the first line of your cond statement, too.


Thursday, March 10th, 2005 10:42:23am

The examples from class today are here:
list-functions-examples.scm
In particular we looked at three loops: map, filter, and foldr. What's important to take from each of these is an understanding of what they do, and an understanding of when to use them. The following table shows what they actually do ... not the code.
LoopContractMeaning
map (X -> Y) (listof X) -> (listof Y) (map f (list x0 x1 ... xn-1))=
(list (f x0) (f x1) ... (f xn-1) )
filter (X -> Boolean) (listof X) -> Boolean (filter f (list x0 x1 ... xn-1))=
(list (f x0) (f x1) ... (f xm) )
where all (f x0) are true.
foldr (X Y -> Y) Y (listof X) -> Y (foldr f b (list x0 x1 ... xn-1))=
(f x0 ... (f x1 (f xn-1 b)))
Here are some English meanings:
  • (map f l): Apply f to all items in l.
  • (filter p l): Keeps those items in l for which p is true.
  • (foldr f b l): Cascade f along the items in l.
Here are some concrete examples of using these functions to improve your programs. Note, I've omitted the examples and tests on this page for space reasons, but they are included in list-functions-examples.scm.

Example 1: add1*: (listof Number) -> (listof Number) We want to add 1 to all the items in a list of numbers. The naive implementation is:

;;add1*: (listof Number) -> (listof Number)
;; adds 1 to all numbers in l
(define (add1* l)
  (cond
    [(empty? l) empty]
    [else (cons (add1 (first l)) (add1* (rest l)))]))
We can identify add1 as the function that we're applying to every item in the list, so we can use map.
;; add1/map*: (listof Number) -> (listof Number)
;; adds 1 to all numbers in l
(define (add1*/map l)
  (map add1 l))

Examples 2: negs: (listof Number) -> (listof Number) We want to keep all the negative numbers in a list. The naive implementation is:

;; negs: (listof Number) -> (listof Number)
;; produces a list of on only the negative numbers in l
(define (negs l)
  (cond
    [(empty? l) empty]
    [else (cond
            [(negative? (first l)) (cons (first l) (negs (rest l)))]
            [else (negs (rest l))])]))
We can see we are using a predicate -- negative? to decide whether to keep items -- and this sounds like we can use filter.
;; negs/filter: (listof Number) -> (listof Number)
;; produces a list of on only the negative numbers in l
(define (negs/filter l)
  (filter negative? l))

Example 3: sum: (listof Number) -> Number We want to sum all the items in a list of numbers. The naive implementation is:
;; sum: (listof Number) -> Number
;; sums the numbers is l
(define (sum l)
  (cond
    [(empty? l) 0]
    [else (+ (first l) (sum (rest l)))]))
We notice, then, that we're cascading + along the items of the list and using 0 as the base case. So, we realize this sounds like foldr.
;; sum/foldr: (listof Number) -> Number
;; sums the numbers is l
(define (sum/foldr l)
  (foldr + 0 l))
Finally, we need to know when to use these loops. First, if you ever write the naive implementations above, you should use loops instead. Secondly, you need to identify when to use loops by purpose statements. These are some trigger statements in purpose statements that should lead you to the proper loop.
LoopTrigger purposes
map
  • Do something to all items in a list...
filter
  • Remove all items such that...
  • Keep all items such that...
foldr
  • Combine the items of a list...
Notice
I have showed you the contracts, meaning, examples, and trigger statements for map, filter, and foldr. You should go ahead and do the same for the rest of the loops. Only after using them can you really understand them!!!

Thursday, March 10th, 2005 9:37:58am

All the examples used in class yesterday are here.

The important topic that we have started talking about is abstraction; in particular we got into loops on Monday. A reason we use abstraction is to have a single point of control for every idea. For example in our example in class we wrote one function that added 1 to every item in a list of numbers and one that subtracted one from every item in a list of numbers. These are the functions:

;; add1-all: (listof Number) -> (listof Number)
;; adds 1 to all in l
(define (add1-all l)
  (cond
    [(empty? l) empty]
    [else (cons (add1 (first l)) (add1-all (rest l)))]))

;; sub1-all: (listof Number) -> (listof Number)
;; subtracts 1 to all in l
(define (sub1-all l)
  (cond
    [(empty? l) empty]
    [else (cons (sub1 (first l)) (sub1-all (rest l)))]))

First, let's abstract over the English version of these functions:
add1-all : add 1 to all items in the list
sub1-all : subtract 1 to all items in the list
To do so we first identify the difference in the two: I have shown these differences in color.
add1-all : add 1 to all items in the list
sub1-all : subtract 1 to all items in the list
Now we make a more general (or abstract) version of these two functions. It's abstract because there's something missing -- i.e. what to do to every item in the list. We'll call this do-something.
f1-all : do-something to all items in the list
So, what we've done is get rid of everything that is the same in add1-all and sub1-all, and moved it to f1-all. The parts that were same -- add 1 and subtract 1 -- are turned into a parameter -- do-something. In order to define a function in terms of f1-all we simply decide what to use for do-something; for add1-all we can use add 1 for do-something; for sub1-all we can use subtract 1 for do-something. Consider
add1-all : f1-all where do-something is add 1
sub1-all : f1-all where do-something is subtract 1
So, if we replace terms in add1-all we have:
f1-all where do-something is add 1
'do-something to all items in the list' where do-something is add 1
add 1 to all items in the list
This was in English. The correlation to Scheme is as follows: instead of English statements, we write functions; instead of defining one sentence in terms of another, we define a function by calling another function. So, instead of creating a new description for f1-al, we write a function:
;; f1-all: (Number -> Number) (listof Number) -> (listof Number)
(define (f1-all do-something l)
  (cond
    [(empty? l) empty]
    [else (cons (do-something (first l)) (f1-all do-something (rest l)))]))
and pulled out the corresponding difference in add1-all and sub1-all as do-something. Then, to define add1-all in terms of f1-all we decide to use that difference -- add1 -- in place of do-something, and this means we call f1-all passing in add1 for do-something. We do similarly for sub1-all:
(define (add1-all l) (f1-all add1 l))
(define (sub1-all l) (f1-all sub1 l))
But, we can use a loop called map that is even more abstract than f1-all. This loop has the following contract:
;; map: (X -> Y) (listof X) -> (listof Y)
That is, map takes a function that consumes data of some type X and produces data of some type Y (note X could be the same as Y, but need not), a list of X, and produces a list of Y. It calls this function on every item in the input list and the outcome of that call becomes an item in the output list. So, we can have X and Ybe Number, and define add1-all and sub1-all as:
(define (add1-all l) (map add1 l))
(define (sub1-all l) (map sub1 l))
Consider a call of add1-all on the list (list 1 2 3) that produces the list (list 2 3 4). Visually this looks like this:
(add1-all (list 1 2 3 ) )
|||
| add1    | add1    | add1   
|||
V V V
(list 2 3 4 )
Another way of thinking about calling map with a function f and list (list i0 i1 ... in-1 ),
(map f (list i0 i1 ... in-1 ) ) = (list (f i0) (f i1) ... (f in-1) )
Another loop is build-list that consumes a Number n and a function f with contract (Number ->X). It produces a list with n items, where the nth item is the result of calling f on n. That is:
(build-list n f ) = (list ( f 0) ( f 1) ... ( f n-1 ) )
Here is an example:
;; id: X -> X
;; identity function
(define (id x) x)

;; simple-list: Number
produce a list of numbers from 0 to n-1
(define (simple-list n)
  (build-list n id))

;; Examples
(equal? (simple-list 0) empty)
(equal? (simple-list 10) (list 0 1 2 3 4 5 6 7 8 9))

Tuesday, March 8th, 2005 10:49:21pm

Since we're a bit behind and school may be closed tomorrow Assignment 8 will be due Thursday 3/9.


Sunday, March 6th, 2005 11:14:28am

I hope you all had a nice break. I have made assignment 8 due this Wednesday, 3/9, because we will cover loops on Monday. In addition, I have changed the description so that the data structure you're using is called Auto, not Car. If you have started the assignment you will have noticed that defining a structure called car doesn't work. This is because car and cdr are another terms for first and rest, respectively; but just not as intuitive.

Wednesday, February 23rd, 2005 6:18:50pm

A student (and a good one) challenged that this program, for additional program #1, works:
;; find-sublist: LoS LoS -> Number
;; retuns the number of times pat occurs in big
(define (find-sublist big pat)
  (cond
    [(or (empty? pat) (empty? big)) 0]
    [(boolean=? (compare big pat) false)
     (find-sublist (rest big) pat)]
    [else (+ 1 (find-sublist (rest big) pat))]))

;; compare: LoS LoS -> Boolean
;; returns true if the first series of big is found in pat
(define (compare big pat)
  (cond
    [(empty? pat) true]
    [(symbol=? (first big) (first pat))
     (compare (rest big) (rest pat))]
    [else false]))
I say it doesn't... can you find the error in it. Hint, here are some tests that fail.

Wednesday, February 23rd, 2005 5:57:18pm

Before coming to lab this Friday, read the introduction.

Monday, February 21st, 2005 7:53:12am

Michael will hold office hours this Tuesday, 2/22, from 2:30-4:30pm. Sarah will hold office hours on Wednesday, 2/23 from 11am-1pm. Here is the material from last Monday and Thursday's class:

Monday, February 21st, 2005 7:53:05am

John Patota expressed an interest in using the newsgroup as a means of communication in this class, and I back him up 100 percent. This is a valuable tool to help solve problems and find answers. Kindly, John has written up instructions for using the news group under thunderbird.
Here they are:
  1. Click on File->New->Account
  2. Select the Newsgroup account option
  3. Enter in your name and e-mail address
  4. The Newsgroup Server is localhost
  5. Enter any name you want as the account name
Now go into SSH Secure Shell Client (Windows)**:
  1. Start up the client
  2. Select the Edit menu, and choose settings
  3. Under the Profile Settings menu, choose tunneling, then select outgoing
  4. Click Add
  5. Pick a display name (e.g., "news")
  6. Select TCP as your protocol
  7. Enter 1119 as the port number
  8. Make sure the Allow local connections only is checked
  9. Enter news.ccs.neu.edu as the destination host
  10. Enter port 119 as the destination port
  11. Click Enter
Lastly, go back to thunderbird:
  1. right click on the newsgroups icon
  2. select "subscribe"
  3. navigate to ccs.courses.csu211
  4. click on the check mark to the right and press ok
I wrote that assuming users also were forwarding an outgoing connection with smtp.ccs.neu.edu on port 25 as well. Information on this can be found on the System's howto page.

Friday, February 18th, 2005 11:38:50am

Homework 7 will be due on Wednesday 2/23, not Monday. I'd suggest you get it done earlier than this, though. Again, the second part of this course is often harder for many students; so don't get behind.

Monday, February 14th, 2005 10:48:12am

The exam results are here. These are histograms of the individual problems, the final score, and one composite of them all. Overall the class did quite well with a median score of about 46/50. Here is an additional breakdown. The problems are "#1" through "#6" and the total score is Total:
Result#1#2#3#4#5#6Total
max 8 10 10 12 10 9 58
min 2 0 0 1 0 0 14
median 8 10 7 10 7 5 45.5
mean 7.07 9.07 6.30 9.61 6.76 4.73 43.57
stddev 1.52 2.15 3.13 2.26 2.84 2.96 11.06
mode 8 10 10 11 6 4 48
I will hand the hard copies back in class today (2/14). If you did well, congratulations! But, do not let up. The rest of this course tends to give students more a problem than the first half. But, if you did do well congratulations!

Thursday, February 10th, 2005 6:27:53pm

No lab Friday (2/11), enjoy it, go skiing!

Thursday, February 10th, 2005 2:32:55pm

The exam location has changed to 13 Snell Library. Same time: 6:30-9:30pm.

Wednesday, February 9th, 2005 6:37:23pm

Michael will hold office hours from 12-2pm tomorrow (2/10) in the regular place. I, also, have my office hours, so please come with questions or just come if you feel lost. Remember, analyze the data, make a template of how one would process that data, make some examples, then start to write functions.

Good luck tomorrow in the exam!


Tuesday, February 8th, 2005 8:56:38am

Sarah will hold office hours Wednesday (Feb 9) from 10am-12pm in the usual place.

Monday, February 7th, 2005 5:48:46pm

Examples are here.

Saturday, February 5th, 2005 9:11:47am

Remember the first midterm will be this Thursday (2/10) from 6:30-9:30pm in Richards 200. It will cover all the material from class, the book, labs, and homework thusfar. It will be open book and open notes.

Thursday, February 3rd, 2005 6:01:43pm

Here is the material from today's class:

Wednesday, February 2nd, 2005 6:17:17pm

Here are the examples from today's class: Remember, always ask the four questions when constructing a template:
  1. How many cond lines?
  2. What are the questions for each line?
  3. What are the selectors for each line?
  4. Any arrows (i.e. self-reference)?
For example, if we have the data definition for a list of numbers:
;; A ListOfNumber is one of
;; -- empty
;; -- (cons Number ListOfNumber)
We ask the first question:
How many cond lines?
and construct the outline of the template:
;; f: ListOfNumber -> ??
(define (f los)
(cond
[ ... ]
[ ... ] ))
Then ask question 2:
What are the questions for each line?
and determine the questions to ask:
;; f: ListOfNumber -> ??
(define (f los)
(cond
[(empty? los) ... ]
[(cons? los) ... ] ))
The ask question 3:
What are the selectors for each line?
and determine how to take apart our input:
;; f: ListOfNumber -> ??
(define (f los)
(cond
[(empty? los) ... ]
[(cons? los) ... (first los) ... ... (rest los)... ] ))
Finally, ask question 4:
Any arrows (i.e. self-reference)?
and the answer is YES, from ListOfNumber in line 2. For every arrow, we get recursion:
;; f: ListOfNumber -> ??
(define (f los)
(cond
[(empty? los) ... ]
[(cons? los) ... (first los) ... ... (f (rest los))... ] ))

Monday, January 31st, 2005 6:00:33pm

Here is the material from class today: Also, as I stated in class today, if you receive a 0 on a quiz, that week's homework (turned in the Monday before that lab) will be deducted 50%; if you get a 1 nothing will happen; if you miss lab you will receive a 0 on that homework.

Thursday, January 27th, 2005 6:31:51pm

Examples from today's class are here: Remeber the main example in class today converting images from color to black and white (or greyscale). Our goal was to write a program called image->bw that behaved in the following manner:
(image->bw ) ; should produce

Knowledge about images or colors was not important. The important concept that we learned today, was that when we process lists of structures our data definition changes; and when our data definition changes our programs for processing that data changes; so we need to change our templates.

The purpose of a template is to provide you with a systematic way of processing data. When you are processing a list there are certain things that remain constant over all types of lists. Consider the data definitions for a list of numbers and a list of strings; paying close attention to the difference between the two:

;; A ListofNumber if either
;; -- empty
;; -- (cons Number ListOfNumber)

;; A ListofString if either
;; -- empty
;; -- (cons String ListOfString)
So, we see that the only difference between the two is what type the first of the list is. So, let's write the templates for these data definitions:
;; ListOfNumber -> ??
(define (f l)
(cond
[(empty? l) ...]
[(cons? l) ... (number-function (first l)) ... (f (rest l)) ...]))

;; ListOfString -> ??
(define (f l)
(cond
[(empty? l) ...]
[(cons? l) ... (string-function (first l)) ... (f (rest l)) ...]))
Not much is different between the two, except what we do to the first of the lists... but we expected that, because the change in the template is directly from the difference in the data definition. But what if we consider a list of Posn? Let's first consider the data definitions:
;; A Posn is a (make-posn x y)
;; where x and y are Numbers

;; A ListofPosn if either
;; -- empty
;; -- (cons Posn ListOfPosn)
Then, we can write the template for lists of Posns.
;; ListOfPosn -> ??
(define (f l)
(cond
[(empty? l) ...]
[(cons? l) ... (posn-function (first l)) ... (f (rest l)) ...]))
This is close, but we actually can take our data definition for lists of Posns a bit further, because we know what makes up a Posn; so we know how to take it apart.
;; A ListofPosn if either
;; -- empty
;; -- (cons (make-posn x y) ListOfPosn)
;; where x and y are Numbers
So, since our data definition changes our template must reflect this change!!!
;; ListOfPosn -> ??
(define (f l)
(cond
[(empty? l) ...]
[(cons? l) ... ((posn-x (first l)) ... (posn-x (first l))
... (f (rest l)) ...]))

So, the main point is our programs always FOLLOW THE DATA!!!


Tuesday, January 25th, 2005 6:13:43am

Sarah with hold an extra office hour today from 2-3pm.

Sunday, January 23rd, 2005 10:16:22pm

Because of the school closing on Monday 1/24, homework #3 will be due at 4:30pm on Tuesday 1/25.

Thursday, January 20th, 2005 5:59:33pm

Here are a couple examples from today's class:

Thursday, January 20th, 2005 4:13:51pm

Additional Problem 1 of homework 3 had a typo in it that asked you to modify Calendar so it would keep track of months. Of course, it already kept track of months, and you should modify it to keep track of days. This has been changed on the assignment.

Thursday, January 20th, 2005 10:15:55am

Per Sean's request, here is the example from class yesterday.

Thursday, January 20th, 2005 9:24:48am

The first assignment included a 30-word description of any problems you encounted. This is now optional and should be a maximum of 30 words. The purpose of this is twofold: First, I want to hear feedback about problems you're having and questions you have that you may not want to voice in class or office hours. Secondly, the 30-word maximum is to get you to write clearly and "to the point"; this will be very valuable in anything you go on to do.

Monday, January 17th, 2005 11:24:59am

You all should have picked up your graded homework #1's in lab. If you didn't, please get them from me. The average was about 16.1 out of 26. Nine of you did not submit homework; if you are one of these people and I have you email address you will have received a message from me asking me to explain why this was the case?

Reminder: Homework #2 is due 1/18 by 4:30, and your contract is due by class time on 1/19. See the general page for information about your contract.


Thursday, January 13th, 2005 3:07:02pm

You will all sign up for lab partners tomorrow. At this time you must -- at least -- get your partner's name, email, and phone number. Since the second homework is due Tuesday and your will not partner up until Friday, the first homework may be done in partners or indidivually. Either, please indicate clearly who worked on any homework handed in.

Wednesday, January 12th, 2005 6:27:01pm

Here is John Patota's explanation of the RSS thingy for the blog.

A few days ago I asked what that RSS link was on the top of the blog. As it turns out, RSS is an easy way to distribute news. Whenever Jeff posts something new on the blog, it gets sent directly to your e-mail messaging program (like Mozilla's thunderbird)

If you use thunderbird, setting this feature up is really easy.

  1. create a new RSS News and Blogs account. Put any name you wish for the label of the account. The default "News and Blogs" works fine.
  2. You'll see a new icon which looks like the world come up on the left hand side of the screen, in the Folders panel. In the main window, click on "Manage Subscriptions" which will bring up a new box.
  3. Add a new account. Remember to input "http://www.ccs.neu.edu/home/jpalm/211-s05/index.xml" and click OK.

And your done

This new RSS thing is becoming very popular. Tons of websites are sharing to come out with things like this. An example would be our very own Northeastern News. Their RSS feed is "http://www.nu-news.com/articles.rss"

Thanks for the note, John.

Tuesday, January 11th, 2005 2:53:00pm

Many of you forgot to write the 30-word description of problems you encountered on your homework, and those people lost points. You will lose points for this every time for forgetting this part. Also, many of you turned in loose papers, and this is unacceptable. You must staple or paper-clip your homework.

My office hours will be on Thursday from 2:30-4:30pm. Please come by if you have any questions or if you're running into problems on the homework.


Monday, January 10th, 2005 6:34:29am

If you have not done so, please read the 'Earning a Grade' section of the General Information page. It states the requirements for earning a greade in this course. I will mention this at today's lecture.

Also, our tutor for the term will be Sarah House. She can be reached at house @ ccs . neu . edu. Sarah's primary responsibility will be grading, but will also hold office hours and pop in lab from time to time.


Friday, January 7th, 2005 5:14:00pm

Everyone please welcome Michael Everett (everett.m @ neu . edu), he will be the TA for the Spring. Michael will run the labs -- starting this Friday 1/14 -- and hold office hours; these office hours will be announced next week.

Thursday, January 6th, 2005 6:39:16pm

The first assignment is due this Monday 1/10 by 4:30, and all assignments will be due at this time. I will post my office hours shortly. In the mean time send any questions to me at: jpalm @ ccs . neu . edu.

Labs will begin next Friday 1/14. You will learn about the format of the labs and decide partnerships. You will complete all labs and homework (after assignmen #1) in partnerships. This is how the real world works, so this is how this class will run. If you cannot make this first lab contact Jeff.

And, remember to brings your name signs next week!


Friday, December 31st, 2004 10:50:30am

Added the gallery.

Thursday, December 30th, 2004 10:08:28am

Welcome to the 211 Blog site for Spring '05. The staff will post important messages here, concerning lectures, projects, presentations, and so on. Make a habit of reading the blog on a daily basis.

Thursday, December 30th, 2004 8:53:35am

Added RSS feed.

last updated on Thursday, April 21st, 2005 10:04:02amgenerated with PLT Scheme -- (Source)