3 ms·
Ehh, not really. It depends on how you define functional programming. C# supports first class functions, tuples, some form of pattern matching and LINQ extensio
by paavohtl 6y ago
Ehh, not really. It depends on how you define functional programming. C# supports first class functions, tuples, some form of pattern matching and LINQ extensions support basic FP collection operations like map (Select), filter (Where) and fold (Aggregate). But I think that's just scratching the surface compared to a "real" FP language:
- F# has function composition operators
- F# functions are curried and support automatic partial application
- F# variables and data structures are immutable by default
- F# has powerful global HM type inference
- F# uses option & result monads over exceptions and null
- F# has algebraic data types with exhaustiveness checking
These capabilities make writing code in F# a very different experience from C#. Some of these can be added to C# as features, but many things are fundamental parts of language design that are hard to change afterwards.
- dleslie 6y agoThat stinks of microallocations from enormous stacks of closures, boxing and similar.