Now, I'm going to complete the design of layout-images.
There's nothing really new in this function.
You know how to design it at this point, but I suggest you follow along with me
anyways. I think you might have heard me say once
or twice that you can never get too much practice.
Now, I want to complete the design of layout-images.
So, the next thing I need to do is some check expects.
Check expect layout-images. Let's see the empty, if you layout the
empty images then that's just going to produce blank.
And now, we'll do one for layout-images of let's see, you know, we can grab this
example from up here, it's a perfectly good example that's too long.
In a minute, I'll use command i to fix the indentation.
Let me just do that, command i fixes the indentation.
Layout-images, well, what's that going to be?
We kind of figured this out before. Right?
It's beside, of this rectangle, this rectangle and blank.
I'll run that. The tests are well formed, but now a
number of tests are failing. I'll go get the template, I'll paste it
in here. I'll comment out the stab, ow!
Meaning the template and the natural recursion.
And now, let's see, if I'm laying out an empty list of integers I've produced
blank, and otherwise, I just put the first image beside the result of the
natural recursion command and fixes the annotation.
I run it. Let's see, there's one test, I have to be
careful. And now one of the four tests are
failing. First thing I need to know is that, is
that a test on layout-images. And it isn't.
When I click on it, it's a test on arrange images.
So, layout-images is actually working properly now.
Why is this test on arrange images failing?
Oh, look, this other test isn't failing. What's happening here is, the arrange
images test where the list doesn't require sorting is working fine.
The arranged images test where the list does require sorting isn't working.
And that's because of this stab we made for sort images that just produces
whatever it's given. If you happen to call sort images with a
list that's already sorting, it happens to work.
So, that's why one of these cases of arrange images is working, and one isn't.
This is going to start to happen more and more.
As you get a big program with multiple stabs in it, some tests might work, some
other tests might not work. The key thing is, since I just finished
layout-images, what I want to be sure is that those tests are passing, and they
are. So, layout-images seems to be done now.
Going back to my overview diagram of where we are in the overall process,
arrange images is still done except it has uncompleted wish list entries.
The layout-images wish list entry is completely done, layout-images is done
and tested. But sort-images is still sitting there in
stab form. That's what we are going to turn to in
the next video.