[Index of Lectures]

[ L01 L02 L03 L04 L05 L06 L07 L08 L09 L10 L11 L12 L13 L14 L15 L16 L17 L18 L19 L20 L21 L22 L23 ]

Lecture 08—Recursive functions on naturals; three more helper rules

Before Lecture

In this lecture we will briefly go through the Naturals module 5a, including module overview and natural numbers.

We will not cover the Parlor Trick in lecture, but you may find that entertaining to watch - it will help you understand that the primitive data in BSL are data definitions like any others. They represent information. You could design them if you wanted to. But it will also show you pretty clearly that not all data definitions are equally good.

Then we will jump into module 5b helpers.

Before this lecture, please work through the Introduction and Function Composition sections in the Helpers module.

During Lecture

The starters for this lecture are:

After Lecture

This lecture began with a quick look at designing functions that consume a natural and produce a result of that size. The example consumed n and produced n+1 nested boxes. You should finish that starter file yourself as soon as possible.

Up until today we had only one helper function rule — the reference rule. But now we have three more: function composition, operate on arbitrary sized data, and knowledge domain switch. Of these four rules, the first three are unambiguous — you need to follow them every time. The knowledge domain switch is more subjective, but you can usually tell pretty clearly when it is in play.

To review this lecture try to re-work the entire example from scratch. Keep a diagram next to you as you go about what functions you are working on, and why you split each function into helpers. Work methodically and know where you are in the recipe at each step.

At this point you are responsible for the entire course up through the Helpers module.

The solutions for this lecture are:

Be sure to complete the before lecture section of Lecture 9 before that lecture.