3.5.4 OO languages: The Full story
This week, you will complete your OO story generation:
-
Add the cache functionality from 1/d
-
Code up the entire scifi grammar and generate a complete story.
Usual Stuff
Setup
Perform the weekly set up instructions for project 2, homework d
If you find that you are missing any files, copy them over from 2/c.
CAUTION: do not
cp 2/c/* as that may copy the magic .svn directory into 2/d (thus messing
up your repo). Copy them over the old-fashioned way (e.g. cp ../c/gold.lisp .
)
then svn add
them.
What to Hand In
Report:
-
All the lisp functions you’ve written;
-
The
‘repl.txt’ coming from your REPL session where you run
(main)
, this time
with 10 samples of your sci fi stories with the "dramatic chords" you code below;
-
Your svn log showing all the commits generated as part of this week’s homework;
-
A file
containing your
deftest
s for all parts of the following.
At least five tests per team member spread out if files with member names.
What to do
-
Add a "$cache" variable and a "$cachep" flag to *rule* such that if the phrase is referenced more than
once, the first time you "act" to find the rewrite and add it to the "$cache".
Subsequently, you just
return the contents of "$cache". Note that:
-
In project1, this special case meant
changing some global procedure. Here, the change is localized to a leaf class.
-
You’re probably going to need one "if" statement in *rule* to hand this caching.
-
Using the 2/c code, add side-effects to a third of the atoms in the story.
-
Code up the entire scifi story as instances of sub-classes of *phrase*.
-
Generate 10 stories, at random, with caching and side effects.
-
(Optional) sell your masterpiece to Spielberg and cut your old lecturer in
for his usual 10%.
This document was generated on April 19, 2011 using texi2html 5.0.