#5
- Look for close correspondence between the imperative
version and the assembly version
- make sure they use "mov" rather than "ld" to move things
between registers.
(They hadn't used "mov" before this problem; part of
the point was needing to figure out how to use it,
from the sheet.)
#3, append!
- they can use the regular ol' "append", if they want:
(define (append! a b)
(set-cdr! a (rest (append a b))))
Note that set-car! of a is *not* needed
(and should be some points off).
- Their contract should have "cons" instead of "list", for the first arg.
Also, if their contract includes empty, OR they
handle the empty list in their code, they should include
a big warning "does NOT change the first argument if
empty list provided", or else lose soem points.
Realizing this limitation is part of understanding the prob.
That's all i can think of, off the top of my head!
--ian
a
(alpha):
Your solution is overly complicated. See soln.
You might wonder, "but my answer works; why does it matter if it's a bit roundabout?"
Imagine hiring a contracter to convert your bed into a loft,
and they do so correctly ... but they have huge extra beams, hanging wires, etc.
Would you say that they are a top-notch contracter?
Providing simple, clear solutions (where they exist) demonstrates
additional understanding.
(Note that an alpha in quotes might refer to a contract -- saying you should have used something generic like an alpha, since "num" is more restrictive than the actual contract.)
g
(gamma):
Use better test cases.
In particular, be sure to include base/degenerate cases (0 for natnums,
empty for lists, 'unknown for FamTrees).
It may be appropriate to try 1 (or, lists of length 1), for
certain functions.
In relative->absolute,
some people had functions which failed for lists of length 0 and 1 for
separate reasons, but worked for length 2 or more.
With FamTrees, it helps you and readers to
define small family trees (a child with no known parents, only one known parent),
and use these smaller trees to build a bigger one.
problem #2:
define.
Thus for circular structures, first make a new actor
with a dummy value for its co-stars,
then after all actors have been defined you
can go back and fill in all the co-star relations properly.
(Cf. hw08's connect-caves.)
consing on to (void) rather than a list;
-1 for building up some big list and then throwing it away
w/o ever using it.
halt instruction.
cond;
as in algebra, you use "=" to assert that two expressions
have an equal value.
(As discussed on
example
hand eval
and
homework
laws.)
local is one solution.
(This is not a question of efficiency -- negligible to
do one extra multiplication, plus the compiler probably optimizes
that for use -- but rather
of having a central point of control, and ease of understanding.)
| margin note | Meaning | text markup | |||
| delete | |||||
| insert (caret) | |||||
| insert a space | |||||
| transpose | |||||
| align vertically | |||||
| begin a new paragraph | |||||
| close up | |||||
| let stand | |||||