The two day break was very relaxing; it gave me enough time to briefly review each of my courses, especially this course. Since there were only lectures on Wednesday and Friday, Professor Heap quickly skimmed through the slides and because of that, I decided to solely listen to what he was saying (rather than listening 70% of the time and writing 30% of the time).
In terms of content, this week was whether a function would halt or continue executing in a particular situation. I know that if a program halts, it would not display a result in the python shell, which means it is in an infinite loop, but I am unclear regarding the structure of a halt function. Hopefully, the annotations can provide some clarity. This idea of halt was discussed throughout the rest of the lecture. In python and any other programming language, there are functions that are "computable" and there are functions that are "non-computable". A non-computable function is a function that is well defined, but does not tell how to compute it. An example of a non-computable function is the halt function that was mentioned a few sentences ago. In other words, the halt function cannot be easily identified as a computable function because it could display a result in the python shell after a certain number of minutes. A typical function such as "str.isdigit()" displays its result instantaneously; with the halt function however, it may not display its result instantly; it may in fact not display anything at all, which indicates it's non-computability. I did encounter this problem while working on an program for CSC108H1. The task of the program was to display the author of a text file based on a set of characteristics; one of them was called "average sentence length". Once the program reads a file, it will display the name of the author in the shell. In some cases, the author name was displayed instantly. In other cases, it took several minutes for the result to display. That is an example of a "non-computable" function. If I was impatient, I could have stopped the execution of the program if it failed to display a result within a span of a few seconds. I may have assumed that one of the functions in the program was executing an infinite loop.
To conclude this week's blog, next week is the last week of the course! I am very excited while at the same time feel a little overwhelmed. My first exam is to be held on December 8, while the exam for this course is to be held on December 10, which gives me approximately 2 and a half weeks to prepare. I am certain that I will focus heavily on this course and use all my resources to thoroughly prepare for this exam.
No comments:
Post a Comment