Here are a few of my favorite programming-related links that I’ve run across lately.
Thanks for the link to the functional programming talk. I’d have written the Python examples a bit differently:
sum(int(t) for t in expr.split('+') if t)
next(name for name in iter(raw_input, None) if name)
And, yes, we don’t have tail recursion, but this isn’t bad:
def fib(N): a, b = 1, 1 for i in xrange(N): yield a a, b = b, a + b
John D. Cook
Subscribe RSS
Subscribe by Email
Thanks for the link to the functional programming talk. I’d have written the Python examples a bit differently:
sum(int(t) for t in expr.split('+') if t)
next(name for name in iter(raw_input, None) if name)
And, yes, we don’t have tail recursion, but this isn’t bad:
def fib(N):
a, b = 1, 1
for i in xrange(N):
yield a
a, b = b, a + b