2 ms·
No, but your options are limited to Java and embedded shops. You absolutely ought to understand functional programming to develop .Net- or Javascript-based appl
by Khelavaster 8y ago
No, but your options are limited to Java and embedded shops. You absolutely ought to understand functional programming to develop .Net- or Javascript-based applications.
- wahern 8y agoNeither C# nor JavaScript provide guaranteed tail-call optimization. The sine qua non of functional programming is using recursion instead of iteration, therefore without TCO you can't actually program in a rigorously functional manner (whether pure or impure). When people discuss "functional programming" they're typically discussing high-level, idiomatic functional interfaces like map-filter-reduce. Though without TCO implementing those interfaces often requires some internal ugliness, and without first-class functions and lexical closures they won't compose as well. TL;DR: Sprinkle the identifiers "map", "filter", and "reduce" in your code and it'll magically become functional-oriented as far as most people are concerned. But if you really want to begin to think in a functional mindset, rewrite your program structure to use recursion instead of iteration. When you do that for non-trivial code you'll naturally discover and appreciate all the other functional-oriented approaches, like first-class functions, closures, currying, etc, even without being told the formal names of those concepts; and increasingly use functional- rather OOP-based data encapsulation, which in turn makes it more obvious how and why to minimize data mutation in favor of pure functions. FWIW, JavaScript supports many of these concepts quite well, but because of the TCO limitation they're applied rather inconsistently and not always in the best way.
- danielpernik 8y agoWTF does it mean you are limited to Java? Java 8+ has pretty cool stuff around FP.