One thought on “Programming miscellany

  1. 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

Leave a Reply

Your email address will not be published. Required fields are marked *