It went BlooP in the night
Modified: 2016-07-11
Status: in progress
It has taken me 16 months of on-and-off reading, re-reading, and numerous failures of understanding to reach Chapter XIII, ‘BlooP and FlooP and GlooP’ of the tome Godel Escher Bach. I intend to deny myself the joy of moving on in the book until I have given the suggested exercises an honest attempt.
These suggested exercises will hopefully teach me something of the power of different computer languages. As an overview the different languages described in the text are:
- BlooP. Bounded loops only. AKA predictably finite.
- FlooP. Unpredictable or finite loops allowed.
- GlooP. A mystery to be revealed. Early guess: ‘G’ stands for ‘Godel’.
The Github repo contains my attempts at realising different functions in any of the above languages. Python was used for easy-going coding.
Principles.
In keeping with the spirit of the task the fundamental operations that are explicity allowed in the python code are:
- addition
- multiplication
- for and while loops
- if statements
- equality operators
Bloop
Here is one Bloop example:
def MINUS(M,N):
"""return the result of subtracting N from M"""
ans = 0
if M < N:
return ans
else:
for x in range(M+1):
if ans+N == M:
return ans
else:
ans +=1
print 'MINUS error!'
return -1