Tip:
Highlight text to annotate it
X
Here's doctor racket using Intermediate Student with lambda.
We'll require some tools from picturing programs.
I also wanna build some stuff with a barracuda...
so I'll copy it into the program.
I'll name it BAR
for short.
I'd like to be able to rotate BAR, one degree at a time. This is what I mean.
I expect rotate-1 to work on with other images, for example that hacker that
comes along with picturing-programs.
When I click run,
there's an error because I haven't defined rotate-1 yet, so let's get on
that.
First, a contract
that I write for myself, not for DrRacket. It says rotate one takes an image and
produces an image.
And a summary sentence
that says whatever image is provided,
I rotate it by one degree.
Now I'm ready to define rotate-1.
The keyword define,
rotate-1
and then a placeholder for an image...
now I say what I do to the image.
Rotate it by one degree.
I click one, pass all the tests. Now I can use rotate-1 on BAR.
There's bar rotated a little bit. Alt-P takes me up,
I can edit that, and rotate an already-rotated bar.
I can take it a step further, and rotate and already-rotated already-rotated BAR.
But, this is getting labor intensive! I would like BAR to respond
to the ticking of some kind of cosmic clock.
So I'll use big-***,
to start a universe that's really simple, it just consists
of bar responding... responding to the clock for now.
On every tick of the cosmic clock,
I'll rotate BAR one degree.
Try running that...
Ooops...
big-*** wants to know
how to draw BAR.
So I can edit my big-***
invocation...
and say to-draw
just show...
my universe.
Click run.
Ooops... BAR is rotating but that isn't what I had in mind. I'm gonna have to fix this
next video!