Ashwani 的个人资料Ashwani Roy's BI Blog照片日志列表更多 ![]() | 帮助 |
|
|
10月26日 F#- What , Why and BI – My First LookI am preparing a demo for User Group in UK of how F# can used with Business Intelligence. Frankly speaking I don’t know the end result but as I go along I am going to keep blogging about what I am learning in F# with simple examples. The aim is to have a series of blog post on this new language (something like I have done for ADO.NET entity Framework on http://csentities.wordpress.com ) which will serve as a quick start guide and possibly will open up areas of discussion where I will be using F# with BI to add the power of functional programming into Business Intelligence. I will be using VS 2010 (I have a Beta 2 Ultimate as of now but the code should work with VS 2008 and fsi.exe). So Lets go ahead and start a new Blank Solution Now lets go ahead and add a new F# console application. Now Open the program.fs and paste the code given below in it. open System let a = 2 Console.WriteLine(a) Console.Read()
Now if you hover over the Console.Read() you will see an error saying “The expression should have type ‘uint’, but has type ‘int’. Use ‘ignore’ to discard the result of the expression , or let to bind to a name.” If you write Console.Read() in C# you will not get any diagnostic warning like this. This reminds you that you want to either pipe the result to ignore (e.g. if just calling a function for its side-effects) or else use the result. There are a handful of minor diagnostic improvements like this (though there is still plenty of room for us to continue to improve). If you want to get rid of this warning message then use the code below. open System let a = 2 Console.WriteLine(a) ignore(Console.Read())
Run the application and your output will be look like this Console.Read is just to hold the screen for us to see it and the screen exits when you hit any key after this. So by now we know how to create a simple F# console application writes something to the console. Watch out for the coming posts. 6月24日 F# – Microsoft’s answer to functional Programming“F# supports functional programming, object-oriented programming, and imperative programming.” MSDN Object-oriented programming (OOP) is a programming paradigm that uses "objects" — data structures consisting of datafields and methods — and their interactions to design applications and computer programs. Programming techniques may include features such as information hiding, data abstraction, encapsulation, modularity, polymorphism, and inheritance. It was not commonly used in mainstream software application development until the early 1990s. Wikipedia :- http://en.wikipedia.org/wiki/Object_oriented Functional Programming :- It emphasizes on functions rather than change of state . Wikipedia : - http://en.wikipedia.org/wiki/Functional_programming More information on F# :- http://msdn.microsoft.com/en-gb/library/dd553242(VS.100).aspx . Don Syme from Microsoft Research lab @ cambridge is the principle architect . Though this langauge it looks like it is OCaml it is much more than just OCaml. It also brings to the table , the .net framwork and a way to use F# classes into any other langauge as C#. So with this language I would say Microsoft has finally married off mathematially modellers and programmers and made a bigger happier family. I will be blogging more on it. |
|
|