Hello world in F# is here.
F# is a great addition to the .NET set of languages because of its functional paradigm support.
You can go directly to the F# Info section to get some extra info about the language.
By the way, you can see my previous post here: http://carlosqt.blogspot.com/2010/06/oo-hello-world.html
where I give some details on WHY these "OO Hello World series" samples.
By the way, you can see my previous post here: http://carlosqt.blogspot.com/2010/06/oo-hello-world.html
where I give some details on WHY these "OO Hello World series" samples.
Version 1 (Minimal): 
The minimum you need to type to get your program compiled and running.
type Greet(name:string) = 
    member private self.name = name.[0].ToString().ToUpper() + name.[1..]
    member self.Salute() = printfn "Hello %s!" name
// Greet the world!
 let g = Greet("world")
 g.Salute()
Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
namespace GreetProgram
open System
type Greet(name:string) = class
    member private self.name = name.[0].ToString().ToUpper() + name.[1..]
    member public self.Salute() = printfn "Hello %s!" self.name
end
// Greet the world!
module GreetModule =
    let g:Greet = new Greet("world")
    g.Salute()
The Program Output:
F# Info:
F# (pronounced “F Sharp”) is the latest addition to the Microsoft programming languages. 
“F# is a succinct, expressive and efficient functional and object-oriented language for .NET which helps you write simple code to solve complex problems.” “F# brings you type safe, succinct, efficient and expressive functional programming language on the .NET platform. It is a simple and pragmatic language, and has particular strengths in data-oriented programming, parallel I/O programming, parallel CPU programming, scripting and algorithmic development. It lets you access a huge .NET library and tools base and comes with a strong set of Visual Studio development tools. F# combines the advantages of typed functional programming with a high-quality, well-supported modern runtime system.” Taken from (http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/default.aspx)
“F# is a programming language that provides support for functional programming in addition to traditional object-oriented and imperative (procedural) programming. The Visual F# product provides support for developing F# applications and extending other .NET Framework applications by using F# code. F# is a first-class member of the .NET Framework languages and retains a strong resemblance to the ML family of functional languages.” Taken from: (http://msdn.microsoft.com/en-us/library/dd233154.aspx)
Appeared: 
 |    
2005 
 |   
Current Version: 
 |    |
Developed by: 
 |    
Microsoft 
 |   
Creator: 
 |    
Don Syme 
 |   
Influenced by: 
 |    
OCaml (Xavier Leroy) 
 |   
Predecessor Language 
 |    |
Predecessor Appeared 
 |    |
Predecessor Creator 
 |    |
Runtime Target: 
 |    
CLR 
 |   
Latest Framework Target: 
 |    
4.0 
 |   
Mono Target: 
 |    
Yes 
 |   
Allows Unmanaged Code: 
 |    
No 
 |   
Source Code Extension: 
 |    
“.fs”, “.fsx” 
 |   
Keywords: 
 |    
97 
 |   
Case Sensitive: 
 |    
Yes 
 |   
Free Version Available: 
 |    
Yes 
 |   
Open Source: 
 |    
No 
 |   
Standard: 
 |    
No 
 |   
Latest IDE Support: 
 |    
Visual Studio 2010 (std, pro, etc) or Visual Studio   2008 (std, pro, shell) 
SharpDevelop 3.2/4.0 (beta) 
MonoDevelop 2.2 
 |   
Language Reference: 
 |    |
Extra Info: 
 |    

No comments:
Post a Comment