Week 1b introduced our first Design Recipe for how to design functions. The design recipe has five parts which should be completed more or less in order. While they may seem like overkill for a small function, I am certain they will help writing large and complicated programs. I went through all of the week’s practice problems before attempting the Module Assessment, this helped solidify the steps, syntax, and style required to succeed in the course.
The language itself, Racket, has many many things we will need to look up in HelpDesk. For example, while it has the type Number, there is also type Natural which is a subset of Number and should be used if it is suitable to the program. It makes no sense for the instructor to go over every little bit of the language. First of all it would be impossible, and secondly this way we are forced to teach ourselves and explore the documentation.
Week 2 moves on from functions to data. If we can define and therefore restrict the type of data our functions receive, it would be easier to design the functions. The first half of the week introduced three new data structures: intervals, enumerations, and itemizations. One example of each was given and we designed a formal data definition (according to the recipe). At first it was a bit overwhelming to read through the recipe, but after a bit of practice it is fairly intuitive.
The second half of the week shows how to design functions based on these new data types. There are a lot of things to keep track of, which is why following the recipes is key. I am slightly terrified of what’s to come, it seems this course is ramping up quite rapidly!