2 ms·
> If you've ever worked with data scientists working with Python, you'll quite often see them all chained together, probably with some other list comprehensions
by runeks 9y ago
> If you've ever worked with data scientists working with Python, you'll quite often see them all chained together, probably with some other list comprehensions thrown in until it becomes one incomprehensible line.
It's not incomprehensible, it's just phrased a different way from what you're used to.
A lot of programming boils down to mutating local or global state, by executing lines of code -- each of which mutating the contents of some variable somewhere -- in order, one at a time. But this is just one style of programming, and is not the only one. When using map, filter, reduce etc. we, instead, construct a path through which data flows, where each line modifies some aspect of the data, as it flows through the path. This is essentially what Functional Reactive Programming is, although you can get the same effect using a pure language and function composition.
- jpttsn 9y ago> It's not incomprehensible, it's just phrased a different way from what you're used to. What would be incomprehensible?
- coldtea 9y agoCode that's badly written. As opposed to code that just uses chained map, reduce etc as opposed to nested or sequential for loops. One is a difference is skill, clarity etc, the other is a difference in style (imperative vs fp).