9.26.06 Lecture Writers all had some aspect of morality in their writings.even if it was different from ours Mercantile system: grew up requiring that government maintained favorable balance of trade.import few goods and protect their own wealth, and
"Challenges to and critiques of Euro-centric conceptions of capitalism" historical context and the problem of generalization the problem of the unit of analysis: from national to global perspective Historical context and the problem of generalization
CS 61A Week 6 solutions
2.25. Extract 7
(cadr (caddr '(1 3 (5 7) 9)
I did that one by knowing that "cadr" means "the second element" and
"caddr" means "the third element," and the seven is the second element
of the third element of the over
CS 61A Week 5 solutions
Skipping the ones that just say "try this".
(define (+rat a b)
(make-rational (+ (* (numerator a) (denominator b)
(* (denominator a) (numerator b)
(* (denominator a) (denominator b)
; Constructor and sele
CS 61A Week 4 solutions
1. Error message hunt
+: not a number: foo
unbound variable: zot
eval: bad function in : (3)
too many arguments to: (bf 3 5)
random: bad number: -7
sqrt: number is negative: -6
Invalid argument to FIRST: ()
CS 61A Laboratory Solutions Week 3
1. How to reverse the order in which coins are tried?
One solution is to reverse the order of the numbers in FIRST-DENOMINATION:
(define (first-denomination kinds-of-coins)
(cond (= kinds-of-coins 1) 50)
CS 61A Week 2 Lab Solutions
f Any definition at all will do:
(define f 'hello) f is hello
(define f (+ 2 3) f is 5
(define (f x) (+ x 7) f is #<procedure f>
(f) This expression says to invoke f as a procedure with no
CS 61A Week 1 Lab Solutions
No problems that required original solutions!
1. Nothing original.
2. If the last letter is Y, then we have to look at the next-to-last:
(define (plural wd)
(if (and (equal? (last wd) 'y)
CS61A Week 14 solutions
4.25 UNLESS in normal vs. applicative order
In ordinary (applicative order) Scheme, this version of FACTORIAL
will be an infinite loop, because the argument subexpression
(* n (factorial (- n 1) is evaluated before UNLE
CS 61A Week 12 solutions
4.3 data-directed eval
The table itself could be done in several ways; perhaps the easiest
is to use the built-in table from chapter 2. So we say:
(put 'quote 'eval text-of-quotation)
(put 'define 'eval eval-definition)
CS 61A - Week 9 solutions
1. Use a LET to keep both initial and current balance
(define (make-account init-amount)
(let (BALANCE INIT-AMOUNT) ; This is the change.
(define (withdraw amount)
(set! balance (- balance amount) balance)
CS 61A - Week 10 Solutions
3.12 append vs. append!
exp1 is (b); exp2 is (b c d). Append (without the !) makes copies of the
two pairs that are part of the list x. (You can tell because it uses
cons, which is the constructor function that
CS 61A Project 3 solutions (Part II)
A6. First we define the FOOD class:
(define-class (food name calories)
(parent (thing name)
(initialize (ask self 'put 'edible? #t)
; or it can be done with a method instead of a property:
(define-class (food name ca
CS 61A Project 3 solutions (Part I)
1. Let's say you live in Bowles, which is east of Lewis. (You have to
work a little harder if you live on Southside!)
; We need a place for you to live before we create you.
(define Bowles (instantiate place 'Bowles)
; Solutions to Picture language project.
; This project is almost entirely about believing in data abstraction;
; except for the problems that ask you to write selectors for an
; abstract data type, there are no CARs or CDRs here.
CS 61A Project #1 (Twenty-One) Solutions
(Note: Although these posted solutions do not include transcripts,
the handout required you to provide transcripts showing that your
procedures work correctly. One of the things you are supposed to
be learning is h
CS 61A Week 15 Solutions
(supervisor ?x (Bitdiddle Ben)
(job ?x (accounting . ?y)
(address ?x (Slumerville . ?y)
The dots are needed because (accounting ?y), for example, would match
only entries in which there was a single element after the wo
CS61A Week 11 solutions
4.27 Lazy vs. mutation
The first time you type COUNT you get 1; the second time you get 2.
Why? When you say
(define w (id (id 10)
the DEFINE special form handler eval-definition EVALs its second
argument (id (id 10). Given
Week 13 solutions
1. The result of (delay .) is of type *promise*.
The result of (force (delay .) is of whatever type the "." would
be without delay; in this case it's (force (delay (+ 1 27) and that's of
2. (stream-cdr (stream-cdr (c
CS 61A Week 12 Lab Solutions
3. Why doesn't make-procedure call eval?
Because none of the arguments to lambda should be evaluated.
In particular, the expressions that make up the body of the procedure are
not evaluated until the procedure is *invoked*!
Week 11 solutions
1. Send message to multiple clients.
We're supposed to do this all in the client program. Here's the code that
sends messages now:
(define (im who message)
;Send message to who.
(if (not (send-msg whoiam who "send-msg" messa
CS 61A - Week 10 Solutions
3.16 incorrect count-pairs
This procedure would work fine for any list structure that can be expressed
as (quote <anything>). It fails when there are two pointers to the same pair.
(define a '(1 2 3) (count-pairs a) ->
How to use LangLab
How to Start:
1. Start -> Programs -> LangLab -> LangLabClient 2. After a few seconds you should see the LangLab Course Selection window. 3. Select "Chinese 1A 3rd-ed" using the pull-down menu (NOT "Chinese 1A" !). 4. Select