call this "proper tail recursion", I guess because it is kind of boringwithout recursive calls.)Notice that you only get this behavior when you do tail calls. In Lua,this means "return f(...)". None of these ap
. That means that the chance that the first tail occurs on coin j AND there is a streak of K or more heads is given by . Hence, the probability that the first K coins are all heads, OR coin one is the first tails and the remaind...
Not quite dynamic typing. Far too often I end up fixing a bug by wrapping an “int()” or “str()” around a variable. This may be more telling of my programming skills than the language itself, but when throughout the course of my program, ‘foo’ is always a number it drives me...
add the user’s IP address to the message. If someone reports an error, you can later look through the logs to see what they have been up to. This is far better than relying on vague second-hand information about reported problems. ...