|
|
|
|
|
by koenigdavidmj
4860 days ago
|
|
In the Haskell case you could also do something like this to avoid needing that optimisation: map (f . g . h) someList
And in Python 3, map returns an iterator, not a list, so you aren't building the full list until you ask for it, and you never build intermediate lists in your example. You can do the same thing in Python 2 with the itertools.imap function. |
|
This is why we have optimizing compilers. They do what you could have done, only more often, and without mistakes.