3 ms·
> Python, and ES2015, have done a wonderful job of bringing many previously-academic (including functional) programming constructs to a broader community This
by saagarjha 4y ago
> Python, and ES2015, have done a wonderful job of bringing many previously-academic (including functional) programming constructs to a broader community
This is kind of amusing to hear considering that Python seems to actively design itself around making typical functional programming constructs difficult and JavaScript has a bunch of weird quirks with how it implements things (you’ve seen the “map” joke perhaps?)
- greymalik 4y agoI program professionally in both languages and in my experience the two are very different when it comes to functional programming. FP is viable in JavaScript, if imperfect. And as the language continues to evolve to better support that paradigm its community continues to embrace it. But Python’s choices seem to be actively antagonistic to FP. I’d like to be able to use a functional approach in Python when it makes sense but it’s too hard, too awkward, too flawed, and too against the grain of the language.
- saagarjha 4y agoI’d agree in the sense that JavaScript gives you poor out-of-the-box support but it definitely can be shaped into something pleasant. Python will make you hate yourself if you try, yes.
- blagie 4y agoThe major thing Python has done is bring major functional design patterns, like maps, reductions, everything in itertools, and made human-friendly versions and syntax for them. Right now, that covers 70% of the stuff I did in Scheme over C/C++ (weighed by volume of use, rather than by feature list). A lot of beginner programmers now use features like closures and decorators, and they're accessible. The remaining 30% is awkward, but usually possible. JavaScript is convoluted.... but after the learning curve, it does functional as well as anything, and better than most other things it does. It certainly does functional better than OO.
- int_19h 4y agoI would argue that, as far as popularizing sequence comprehensions goes, C# (LINQ) was probably more influential than Python.
- blagie 4y agoHejlsberg is a genius. Before C#, he designed Delphi, which was a pleasure to use. It made Pascal beautiful, which is not something many considered possible. Functionally, Delphi combined the ease-of-use of VisualBASIC with the power of C++, with an elegance unparalleled in any environment before. He did Turbo Pascal. It's hard to overstate how much of a revolution that was. Compile-wait-wait-wait-run turned into run. Now, he's doing TypeScript. I'm not sure it's really fair to compare anyone to Hejlsberg. "Sure, your kid won a Nobel Prize for his research, but Einstein did relativity...." "Sure, your business hit a billion dollars, but it's no Apple...." Acknowledging brilliance elsewhere doesn't reduce my appreciation of Python. It's a good language.
- xigoi 4y agoLINQ weirdly renamed basic FP concepts. Why is the map operation called “Select”? If anything, I'd expect the filter operation to be called that.
- tsimionescu 4y agoIt's SQL inspired language, because SQL is far and away more well known, and understandable, than functional programming. And that is one reason why LINQ is still one of the only functional collections APIs that exposes GroupBy, which is an extremely useful operation. Edit: correction, LINQ is no longer the only one that introduced GroupBy, but it was probably the first.