Description #
F# is a functional-first programming language that runs on the .NET platform. It blends functional, object-oriented, and imperative styles and is designed for robust, concise, and type-safe code — especially in domains like data science, finance, and analytics.
History #
F# was developed by Don Syme at Microsoft Research, first released in 2005. It’s derived from OCaml and is fully integrated with .NET, allowing it to interoperate with C#, VB.NET, and other CLR languages.
Key milestones:
- First appeared as a Microsoft Research project in 2005
- Became an officially supported language in Visual Studio 2010
- Now maintained as an open-source project via the F# Software Foundation
- Widely used in data-intensive industries like finance and machine learning
Hello World Code #
printfn "Hello, World!"
How to Run #
Online: #
- Go to https://fable.io/repl/
- Paste the code and run
Locally: #
- Install .NET SDK
- Create a new F# project:
dotnet new console -lang "F#"
Replace the content in Program.fs
with:
printfn "Hello, World!"
Run:
dotnet run
Key Concepts #
printfn
— prints to the console with a newline- Immutable by default — promotes safer code
- Type inference — minimal need to declare types
- Pattern matching — powerful branching tool
- Discriminated unions — define rich data types
- Pipelines (
|>
) — clean, readable function chains - .NET interoperability — access C# libraries and .NET APIs
- Functional-first — but supports OOP and imperative code
- Concise syntax — less boilerplate than C# or Java
- Scripting mode — use F# interactively with
.fsx
scripts
Try It Online #
🔗 Fable F# Web REPL
🔗 Try .NET F# Interactive
🔗 Replit – F#
Fun Facts #
- The F# logo is a stylized Greek letter Phi (Φ)
- F# was inspired by OCaml but runs on the .NET CLR
- It’s used by companies like Jet.com, Genetic Finance, and Microsoft AI
- F# supports Excel-style scripting with full access to .NET libraries
- F# is considered one of the best languages for functional data modeling