The next three videos are examples of designing a function that consumes non-primitive data, data that's defined by your own data definition. Now, they are HtDF problems so mostly you know how to do them. Remember, I said the HGDF recipe is largely orthogonal to the form of data. But it isn't completely orthogonal [INAUDIBLE] form of data. One real dependence between function design and form of data has to do with the number of tasks that's appropriate for that function. So in these videos I'm going to pay particular attention to the number of test that we're going to use based on the form of data. >> I mean aisle-starter.rkt and the problem we're asked is to use the SeatNum data definition. And design a function that produces true if the given seat number is on the isle. So the first thing I would do is go look at the SeatNum data definition. Then it reminds me that seat number is a natural number from 1 to 32 inclusive, and that its seat numbers in a row and 1 and 32 are the aisle seats. So now I can get started on my function. I'll quickly do the signature purpose and stub. Let's see, it's going to consume a SeatNum and we're supposed to produce true when the seat number is on the aisle. So that means it's going to produce a Boolean. And it'll produce false when the seat number isn't on the aisle. [SOUND] And let's see, produce true if given seat number is on the aisle. [SOUND] And, let's see the function. This is a predicate, so we'll name it using the naming convention for predicates like this, (aisle? sn) is and we'll just produce false for the stub. So let me run that to make sure the stub is well formed than it is. Okay. Now let's get to the examples. Now here is the first place where the data definition is really go have something to say. If we go back to the How to Design Data page, and we go to the section on Intervals, and we go to the section on Guidance on Examples and Tests, it tells us that when writing tests for functions operating on intervals, we should be sure to test closed boundaries as well as mid points. And always be sure to include enough tests to check all other points of variance. So let's go back to the code. I've got an interval with two closed endpoints. So I know that what I'm going to need are three tests. One [SOUND] for the first closed end point which is 1. 1 for the middle, which is, you know, middle doesn't have to be the exact middle. Something like the middle. Well call it 16 and 1 for the closed upper end point which is 32. Now what are these going to be? Well, I'm supposed to produce true if the given seat number is on the aisle. Lets see. This one is on the aisle. This one is not. And this one is. Notice how much information the data definition gave me about generating the test. Data definitions are always going to be helpful this way. They're not always going to make it quite this straightforward but data definitions, the structure of the data definition, the structure of the data tells us a lot about the test we need. So, let me run that. Good, they're all running. Now for the template, what I'm going to do is, I'm first going to come in off the stub. I'm going to say use template from SeatNum and I'll just leave that note or copy the template down. You know, use it like that. I have to rename it to the aisle, that's the name of this function. And let's see. I'm consuming a seat number, which is a natural from 1 to 32. And I need to produce true if it's an aisle seat. That means, I need to produce true if SeatNum is 1. Also SeatNum is 32, and I just need to order those two together. Let's try that. All three tests passed. So, there you go. That's designing a function that consumes an interval. And the big piece of help we got from knowing it's an interval is, well, of course we got the template, but we also got the structure of the tests. In this case, it's an interval with two closed ends. So, we have a test for each of the ends and a test for somewhere in the middle.