Re:Computers are made of metal, not category theory
by TheLoneWolfling on Wednesday October 01, 2014 @04:11PM
(#8397383)
Any half-decent optimizing compiler will turn those two implementations into the exact same assembly.
That being said, that looks like Python source code - and as the default Python interpreter doesn't do much in the way of optimization, you are correct in that case. (Although I wonder about PyPy.)
A more common mistake I notice people making is writing code that makes more memory allocations than necessary.
Overall, I think it is important to remember that when you write a program that every step translates to a set of operations. And this applies to all kinds of programming, not just functional programming.