What can I do with programming F# Programming language? How I can start to learn F# programming? sure bro, you just need to try learn new programming language from this site for step by step with simple descriptions.
The Prospect Promised in F# Programming Language
- Functional programming makes it easy for us to do the composition of functions in the program, because the function (C# and VB method) can be determined as a pure function without side effect. Of course it is also very easy to make a program in parallel, as in the functional programming does not dispute the sequence of execution of functions that we make.
- By default, a Variable in F# programming language are immutable. It's means could not be changed again after any values filled in. and very safe from side effects if used inside the functions.
- F# provides Asynchronous programming by default in the language.
- F# provides pattern matching for different types of variable.
- A Function in F # is a data, and writing of the code very succinct.
- F# can be expressive provides currying parameters. Because the parameters in F # can be either a function anyway and function are considered as data.
- Type in F# by default is type inference. Type inference is already in the F # at the start, compare the new C# 3.0 and VB 9.0 starts at v (C # 3.0 and VB 9.0 is part of VS 2008)
- Recursive in F # is very fast, can do recursive more than in C# and VB without experiencing "stack overflow".
- F# is an OOP in the .Net and also supports imperative programming. variable can be created with the addition of mutable keyword mutable.
- F# could be aligned with the Haskell programming language is one that is very functional, though not all featured in F #.
- Moreover, in the F# 1.2 version and above are facilities named "measure of unit ", we can provide the units of measurement such as meters, kilograms, and so on.
What are the advantages that take precedence in F # by Microsoft?
One answer to the challenge that the .Net now has a family member paradigm functional programming language by default. Isn't Now C# and VB.Net are beginning to support functional programming with the "lambda expression"? F# have a lambda expression from earlier versions.Even the concept of generic type in C# and VB.Net is the initial idea of Don Syme. Don Syme was Mr. F# as well.
Example in C#
Consider generating functions from the add function.Func<int,int,int> add = (x,y) => x + y;We can add curry by applying to add the Curry function.
Func<int,Func<int,int>> curriedAdd = add.Curry();This curried add function is really a function that creates functions that add n where n is the argument to the add function is curried. For example, we can create an increment function by applying the curried function to add the value one.
Func<int,int> inc = curriedAdd(1);The increment function will now return one plus the value of its argument when invoked. We can use our three functions to do various forms of addition.
Console.WriteLine(add(3,4)); // 7So how would this function Curry look? It’s really pretty simple.
Console.WriteLine(curriedAdd(3)(5)); // 8
Console.WriteLine(inc(2)); // 3
public static Func<A, Func<B, R>> Curry<A, B, R>(this Func<A, B, R> f)
{
return a => b => f(a, b);
}
If in the F#
> let add a b = a + b;;
val add : int -> int -> int
> let curriedaddC = add c;;
val curriedaddC : int -> int