Click here to Skip to main content
Licence CPOL
First Posted 13 Jul 2009
Views 11,691
Bookmarked 10 times

F# - Functional Language From Microsoft

By | 17 Jul 2009 | Article
F# is new Functional language and is built on .NET framework.


  • Introduction

  • Features

  • F# Interactive Console  

  • F# Keywords

  • Supported IDE

    • Visual Studio 2008 
    • Visual Studio 2010

  • Web References

  • Books 

 

Introduction   

 F# is a functional programming language that is built on .NET Framework. It is concise, expressive and composible, the features of typed programming language.

This means that F# has immediate access to all the all .NET Framework APIs  like WPF and DirectX. Similarly, libraries developed in F# may be used from other .NET languages.

Functional language implement mathematical functional instead of maintaining state of objects.Functional language is rely on lambda calculus.

Erlang, Haskell, Lisp, ML, and Scheme  are the languages that relied on lambda calculus.

Features 

  • Embraces object-oriented programming and includes support for type-inferring, succinct descriptions of object types.

  • Support for the features of functional programming including tuples, lists, options, function values, local function definitions, pattern matching and sequence expressions.

  • The powerful type inference allow code to be both succinct and yet fully type-checked.

  • F# also includes support for advanced functional programming constructs such as active patterns and computational expressions.

  • Includes support for a form of meta-programming, This allows data queries to be expressed and type-checked in F# code and then dynamically compiled and translated to target languages such as SQL using the LinqToSql framework.

  • F# supports advanced language and runtime features such as Unicode strings, dynamic linking, preemptive multithreading, and SMP support.

  • The F# Interactive environment fsi.exe supports top-level development and exploration of the dynamics of your code and environment.

  • Visual Studio integration that supports features such as an integrated build/debug environment, graphical debugging, interactive syntax highlighting, parsing and type checking, IntelliSense etc.

  • F# can be used with tools from the .NET Framework, Microsoft's Visual Studio and many other .NET development tools. 

F# Interactive Console 

 F# console Application compile and run in Interactive console.Just select the code and right click on Send to interactive to compile and run code interactively.

Here I have written one sample console application, that compiles and run interactively.  Here is F# console application template and demo application screen shot.

   fsharp1.JPG fsharp2.JPG

 

 fsharp4.JPG

 

 

F# Keywords 

let is the most important keyword and used to declare and assign variables. Similarly we can define functions by using let. 

For example

let x=0

declare a variable and assign value 0, so by type inference x will we integer.

Second most important keyword of F# is pipe (|>), that is used to send output from one pipe to another.

let square x=x*x

let sumOfsquares nums=

nums

       |>Seq.map square

       |>Seq.sum

here sequence of square of numbers passed to next pipeline to sum up the squares.

Supported IDE 

F# is available for Visual Studio 2008 and Visual Studio 2010. F# will be included in VS 2010 just like other languages, for VS 2008 F# is available as an addin. F# Down loads are available at Microsoft Research.

Web References

Books  

Foundations of F# by Robert Pickering

Expert F# by Don Syme, Adam Granicz, Antonio Cisternino

F# for Scientists by Jon Harrop   

Programming F# by Chris Smith 



License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Aneesur Rehman Khan

Team Leader

India India

Member

Anees is working as Sr. Team Lead based in Delhi(India).He is Post graduated in Computer applications and science.
 
He is having around 11 years of design,analysis and coding experience in Sharepoint, ASP.NET, C#, VB.NET, SQL Server 2000/05, Reporting Services,Analysis Services,VB 6.0 and Crystal Reports.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmembersfedorov198222:15 11 Feb '10  
GeneralMy vote of 1 Pinmembervladz@inbox.ru19:48 25 Aug '09  
GeneralMy vote of 1 PinmemberVMykyt21:57 15 Jul '09  
GeneralRe: My vote of 1 PinmemberAneesur Rehman Khan0:11 16 Jul '09  
GeneralMy vote of 1 PinmemberJosh Fischer4:59 15 Jul '09  
GeneralRe: My vote of 1 PinmemberAneesur Rehman Khan21:01 15 Jul '09  
GeneralMy vote of 1 Pinmemberswiszcz4:42 15 Jul '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 17 Jul 2009
Article Copyright 2009 by Aneesur Rehman Khan
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid