Tuesday, April 17, 2012

Thinking in functional style F# and some C#

Multicore CPUs is making people look at functional.
1. What is functional? No assignment. Controlled assignments.
2. What is wrong with mutability? Problem when shared.
3. If it is immutable no locks are required. Immutable variables in F#. F# is Hybrid functional because it allows you to declare variables as mutable. Pure function is one that does not have side effects. They are predictable.  they can be run in parallel. (referential independence)
4. Higher order functions. You can create functions and return functions.
Demo of how functional style reduces code using F# list.filter and list.map

No comments: