2 ms·
Assembly was cryptic in the same sense: you had to translate it to get to the "real" machine code. Fortran was cryptic in the same sense: you had to perform ev
by loup-vaillant 13y ago
Assembly was cryptic in the same sense: you had to translate it to get to the "real" machine code.
Fortran was cryptic in the same sense: you had to perform even more complex translation to get to the "real" assembly.
In other words, you're doing it wrong. You think in sequential terms, loops… and are translating list comprehension to that. Just don't. There are more direct ways. In a list comprehension, there's generally a filter part, and a map part. While they are interleaved during the execution, they are logically separate, and you should think of them that way.
I once specified the processing of a sequence of data as a pipe of maps and filters. A colleague came to me and told "how can you waste all that memory, generating all those lists around?". Dude, this is a specification of the end result, not a computational model. Of course I won't generate 10 big arrays.
Simply put, you need to separate the "what" from the "how".