LectureBlog
Home Assignments Lecture Blog Resources Project Discussion Group
Exam 1 is Mon Oct 20
Exam 2 is Mon Nov 17
Final is Wed Dec 17 at 8a
Echo360 lecture recordings are at
http://echo360.uml.edu/martin201415/orgproglangfall.html
Whiteboard photos are at
https://plus.google.com/u/0/114049637113235097633/posts/USJSUa6M4Vw
Final Exam Results
85 points were available. Mean was ~54. 73 students sat the exam.
Homework
Below is distribution of people's work on the problem sets. Max 1000.
Study notes for Final exam: Attach:opl-body-of-knowledge-fall2014.txt
Meeting 40, Wed Dec 10
- Project demos, part 2, in 3rd Floor Elevator Lobby
Meeting 39, Mon Dec 8
- Project demos, part 1, in 3rd Floor Elevator Lobby
Meeting 38, Fri Dec 5
About projects and presentations/demos
- please have your Project stubbed in by Sunday night
- all project web pages are due 8a Monday morning
- project demonstrations will be held in CS Dept 3rd Floor Elevator Lobby
- bring your laptop running your code to your presentation (if neither partner has a laptoparrange to share one with a classmate)
- bring one printed copy of your web page to your demo
- prepare to present your project in about 3 minutes
- attendance at your presentation is mandatory
- attendance at demonstrations on the day you're not presenting is optional
About final exam
- there will be check-boxes to replace Exam 1 and/or Exam 2 scores with score on Final
- you may bring 3 sheets of double-sided handwritten notes to the final
- partial credit will be awarded on most if not all problems
- all Exam 1 and Exam 2 material, plus:
- objects and state encapsulationsee exercises at https://grader.cs.uml.edu/assignments/454
- streams
- meta-circular interpreter
Today's material
- procedure application for compound procedures
let->combination
Course evaluations
Meeting 37, Wed Dec 3
- about partial credit
- Project Flyer and Web Page https://grader.cs.uml.edu/assignments/458
- more metacircular interpreter
Meeting 36, Mon Dec 1
- study material for understanding environments and closures posted here: https://grader.cs.uml.edu/assignments/454
- Exam 2 Results
34 points were available. Mean was ~21. High score was 33. Approximate grading boundaries illustrated below, over full grading histogram.
- PS9 Metacircular Interpreter posted, due Mon 12/15
Meeting 35, Mon Nov 24
- the Sieve of Eratosthenes
- continuing with Final Project Presentations
Meeting 34, Fri Nov 21
- FP First Deliverable is due Mon 11/24 https://grader.cs.uml.edu/assignments/452
- PS8 Streams is assigned; due Wed 11/26 https://grader.cs.uml.edu/assignments/450
- memo-izationusing closures to make it happen
- stream examples:
add-streams
and Fibonacci stream - dynamic programming example from Computing IV: DNA sequence alignment
Meeting 33, Wed Nov 19
- introducing streams (Section 3.5 of book)
- after class, PS8 was posted, due Wed 11/26
Meeting 32, Mon Nov 17
- Exam 2 administered
Meeting 31, Fri Nov 14
- Exam stuff
- PS5 and PS6 solutions will be mailed to newsgroup
- They are password-protected and the password will be given in lecture
- You are allowed one 8.5x11" page of handwritten notes (double-sided OK)
- OPL Final project proposal presentations
Meeting 30, Wed Nov 12
Exam 2 review:
- equivalence of
let
andlambda
; thatlet
is syntactic sugar forlambda
(Section 1.3.2, Usinglet
to create local variables)- You should be able to translate from
let
expressions to their equivalentlambda
expressions - and vice-versa
- and for nested let's / lambda's.
- You should be able to translate from
- equality testing via
eq?
(same object),eqv?
(individual items having same value, tested with=
for numbers oreq?
for other things), andequal?
(recursively testing structures usingeqv?
)- numeric equality (
=
operator) is defined as:
“An inexact number is numerically equal to an exact number when the exact coercion of the inexact number is the exact number. Also, 0.0 and -0.0 are numerically equal, but +nan.0 is not numerically equal to itself.”
http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3d%29%29 - symbols are
eq?
to themselves; i.e.,(eq? 'foo 'foo)
is#t
. - there is only one empty list; i.e.,
(eq? '() '())
is#t
. - given various objects, you should be able to say whether they are
eq?
,eqv?
, and/orequal?
to each other.
- numeric equality (
- the symbolic differentiation problem set—how it works
- the type systems problem set—how it works
Meeting 29, Mon Nov 10
- Exam 2 is Mon Nov 17
- Attach:oo-notes.pdf
- Final Project Proposal is assigned; due Fri 11/14 https://grader.cs.uml.edu/assignments/446
- going over adventure game PS code
Meeting 28, Fri Nov 7
- discussion of simple-oo code
- super brief into to adventure game PS
Meeting 27, Wed Nov 5
- Exam 1 handed back; average was ~22. Results are compressed at the high endmax score was 36, but 6 extra credit points were available
- went over fold problem
- continuing discussion of environments/frames, procedure creation, and closures
Meeting 26, Mon Nov 3
- PS7 Environments and Object Orientation is assigned; due Mon 11/10 https://grader.cs.uml.edu/assignments/430

- Attach:both-simple-oos.pdf handed out
- OPL Mantras handed out
- environment diagrams
Meeting 25, Fri Oct 31
- Type Systems - The Good, Bad and Ugly by Paul Snively and Amanda Laucher
Meeting 24, Wed Oct 29 Continuing discussion of type systems.
- book discusses three ways of organizing type systems:
- generic operations with explicit dispatch,
- data-directed (the
apply-generic
system we're using), and - message-passing.
![]() |
Explicit dispatch |
---|
![]() |
Data-directed |
![]() |
Message-passing |
- Type coercion Section 2.5.2, Combining Data of Different Types
- Let's understand Ex. 2.81, about type coercion (
p5.rkt
).
apply-generic
procedure, and create global bindings (define put-coercion put)
and (define get-coercion get)
.
- Towers of types.
Meeting 23, Mon Oct 27 Continuing discussion of type systems.

- Let's understand Ex. 2.77, about adding complex number selectors to the complex number type (problem p2 in the PS).
- Let's understand Ex. 2.78, about updating
scheme-number
to use Scheme's underlying numerics (problem p3 in the PS). - Let's understand Ex. 2.79, about defining an equality predicate (problem p4 in the PS).
Meeting 22, Fri Oct 24
- Section 2.4 of text, “Multiple Representations for Abstract Data”
- adding and multiplying complex numbersuse rectangular form for add/subtract; polar form for multiply/divide
Meeting 21, Wed Oct 22
- FPE2 is assigned; due Mon 10/27 https://grader.cs.uml.edu/assignments/419
- FP3 Team or Interest Declaration is assigned; due Wed 10/29 https://grader.cs.uml.edu/assignments/420
- PS6 Type Systems is assigned; due Fri 10/31 https://grader.cs.uml.edu/assignments/421
Meeting 20, Mon Oct 20
- Exam 1 administered
Meeting 19, Fri Oct 17
- about FPE1see my newsgroup post and discussion in class of sample work
deep-reverse
blues-sale
- PS4 and anything else for exam
Meeting 18, Wed Oct 15
- PS2 PS3 PS4 answers presented
Meeting 17, Fri Oct 10
- Exam 1 is Mon Oct 20; we'll talk more about it next week
- About the equality predicates:
=
,eq?
,eqv?
, andequal?
https://stackoverflow.com/questions/16299246/what-is-the-difference-between-eq-eqv-equal-and-in-scheme - About the list-membership functions:
memq
,memv
, andmember
http://stackoverflow.com/questions/694669/what-is-the-scheme-function-to-find-an-element-in-a-list - continuing to go over symbolic differentiation PS
Meeting 16, Wed Oct 8
- PS5 is assigned; due next Wednesday https://grader.cs.uml.edu/assignments/403
- FPE1 is assigned; due next Friday https://grader.cs.uml.edu/assignments/404
- go over expectations for final project and FPE1
- introduction to symbolic differentiation PS
Meeting 15, Mon Oct 6
- bucket -- operation changes depending on what the operand is -- see solution at 19:00 mark of the lecture recording.
- flip functions and function composition
- cdDB -- restock and others
Meeting 14, Fri Oct 3
- examples of using cdDB:
(load "freds-db.rkt") (map title cdDB) (titles-in-stock cdDB) (titles-by "The Beatles" cdDB) (copies-in-stock "Revolver" "The Beatles" cdDB) (set! cdDB (restock "Revolver" 10 cdDB)) (copies-in-stock "Revolver" "The Beatles" cdDB) (carry-cd? "The White Album" "The Beatles" cdDB) (carry-cd? "Help!" "The Beatles" cdDB) (blues-sale cdDB)
accumulate
,foldr
, andreduce
are synonyms- they take a list, a binary operator, and an initial value and pairwise apply the binary op to the head of the list and the recursive result
- let's look at
foldl
- some things you can do with accumulation/reduction/folding
- sum up the numbers in a list
- make a product of all #s in a list
- summarize all of the even numbers in a list
- rebuild a list in new ways (using
cons
as the binary op)
tree-manip
is like a tree version of fold
Meeting 13, Wed Oct 1
- data abstraction, constructors and selectors
- do not violate the abstraction barrier
- in other words, use selectors to pick apart compound objects and constructors to build them back up again
cons
,list
and the like should only be in constructorscar
,cadr
etc. should only be in selectors
first
is a synonym forcar
,second
forcadr
, etc.- point and line abstractions; midpoint function
- building point objects using lambdas/message-passing
- look at CDDB problem in PS
Meeting 12, Mon Sep 29
- PS4 is assigned; due next Monday https://grader.cs.uml.edu/assignments/397
- what is a tree?
- tree recursion:
count-tree
andscale-tree
- abstracting it:
tree-manip
Meeting 11, Fri Sep 26
let
islambda
, and closures
Meeting 10, Wed Sep 24
- three
cons
/list
, printed form, and box-and-pointer test items - recap of recursion: base case, recursive case, invariants
- recap of
append
map
filter
accumulate
- lambda and closures and let
Meeting 9, Mon Sep 22
- PS3a extended until Friday
- we left off with
scale-list
- let's look at properties of recursion:
- base case
- recursive case
- invariants what's always true
- state variable(s) (with iterative recursions)
length
-- recursive and iterativelast
append
Meeting 8, Fri Sep 19
- introducing our 2nd TA: Peng Hou. Office hours: Mon 2p to 3:30p.
- TAs are grading PS2 now
- please give yourself more than one session to complete homework
- please try your best to solve problems before looking up answers
- recursive and iterative
sum-nat
(simulated test problems) - list primitives:
cons
,car
,cdr
,list
, andnull?
- What is
(cons 1 (list 2 3 4))
versus(cons (list 1 2 3) 4)
? sum-list
scale-list
Meeting 7, Wed Sep 17
- Fred's office hours: W 2p in Olsen 208, R 2p in Olney 524, F 1p in Olsen 308 (1 hr each). Please confirm before coming if possible.
- issues with PS2?
- let's do exercise 1.11 together
- lists --
cons
,car
, andcdr
- making a list with
list
- summing up a list
- scaling a list
- Assignment 3 is posted; due next Weds https://grader.cs.uml.edu/assignments/385
Meeting 6, Mon Sep 15
- two versions of
expt
- what is tail recursion?
do
, repeat
, until
, for
, and while
. The implementation of Scheme we shall consider in chapter 5 does not share this defect. It will execute an iterative process in constant space, even if the iterative process is described by a recursive procedure. An implementation with this property is called tail-recursive. With a tail-recursive implementation, iteration can be expressed using the ordinary procedure call mechanism, so that special iteration constructs are useful only as syntactic sugar.
- which
expt
is tail-recursive? sum-integers
andsum-cubes
- let's abstract that
Meeting 5, Fri Sep 12
- polls on evaluation questions (these are sample test questions)
- let's look at Eric's recursive square example:
(define (square-r n) (cond ((= n 0) 0) ((= n 1) 1) (else (+ (square-r (- n 1)) n (- n 1)))))
- Re-write it to generate an iterative process.
- passing functions to functions
Meeting 4, Wed Sep 10
- Exam 1 is Mon Oct 20; Exam 2 is Mon Nov 17
- more on iterative vs. recursive processes and substitution model
- reviewing substitution model for two versions of factorial
- exercise 1.9 in class
- demo of Racket development and testing best-practices
- go over PS1 (volunteers?)
- PS2 Iteration vs. Recursion and Higher Order Procedures assigned, due Wed 9/15
Meeting 3, Mon Sep 8
- fire alarm
- TA: Yen-Fu ("Edward") Luo,
edwardluoopl@gmail.com
. Office hours: Tue/Thu 12:30p 2:00p. - what is a predicate?

even?
, odd?
, symbol?
- numeric predicates:
=
,<
,>
- how to use
cond
cond
is syntactic sugar for nestedif
's
(define (die n) (cond ( (= (remainder n 3) 1) 'a ) ( (= (remainder n 3) 2) 'wizard-type ) (else 'sorry-youre-dead)))
and
andor
exist, and have special evaluation rules (they short-circuit)
not
inverts boolean value. Normal evaluation rules apply. Even though it's a procedure that produces a true/false output, it's not considered a predicate because it's not answering a question about its input.- discussion of symbols
- naming is done all lower-case with dashes as word separators
symbol?
tests if a thing is a symbol- symbols are fundamental objects, like numbers and procedures and booleans
- procedures can return symbols
- more on iterative vs. recursive processes
- reviewing substitution model for two versions of factorial
- PS1 Introduction to Scheme is due Wed 9/8
Meeting 2, Fri Sep 5
- introducing our TA: Yen-Fu Luo !
- use group for discussion presently, 62/81 have joined
- Bottlenose you must proactively request account 60/81 are onboard
- class policies
- Scheme numbers exact (ints, rats, arbitrarily large ints) and inexact (floats)
- returning to expressions
(= 3 3)
,(define foo 3)
,(lambda (n) (* n n)
if
expr often used w/o side effects, meaning, it returns a value and doesn't “do stuff”- our first recursion: factorial (recursive process)
- our second recursion: factorial (iterative process)
- PS1 Introduction to Scheme due Wednesday
(lambda (n) (* n n))
?

(define foo 3)
?

Meeting 1, Wed Sep 3
- what is OPL (discussion)?



- introduction to Scheme
- everything is an expression
- some basic data types: numbers, symbols, booleans (there are also strings)
(+ 3 4)
means apply the+
procedure to params3
and4
+
is a procedure- we can bind stuff to symbols, e.g.
(define foo 3)
- we can make procedures, e.g.
(lambda (n) (+ n 1))
increments its arg - we can create a procedure and immediately apply it, e.g.
((lambda (n) (+ n 1)) 3)
is4
- we can name procedures by binding symbols to them, e.g.
(define inc (lambda (n) (+ n 1))
if
is an expression; e.g.(if #f 3 4)
is4
- notes from lecture:
Evaluation rules of scheme: evaluate the first thing, apply to the values of the rest of them. exceptions: DEFINE take the second thing as the name of a symbol, and bind it to the value of the third thing. LAMBDA -- take a list of params and an expression, and create a procedure object with these two things. ------- ENVIRONMENT -- place where symbols are bound to objects TYPES OF OBJECTS: func/procedures datatypes --- numbers, bools
- introduction to Bottlenose
