If someone had told me a few months ago I’d be playing with .NET again after a 15+ years hiatus I probably would have laughed at this. Early on in my career I played with .NET and Java, and even though .NET had done some things better than Java (as it had the opportunity to learn from some early Java mistakes), I quickly settled on Java as it was a truly portable environment. I guess everyone who reads my blog knows that in the past few years I’ve been playing on and off with OCaml and I think it’s safe to say that it has become one of my favorite programming languages - alongside the likes of Ruby and Clojure. My work with OCaml drew my attention recently to F#, an ML targeting .NET, developed by Microsoft. The functional counterpart of the (mostly) object-oriented C#. The newest ML language created… What is F#? Unfortunately, no one can be told what the Matrix is. You have to see it for yourself. – Morpheus, The Matrix Before we start discussing F#, I guess we should answer first the question “What is F#?”. I’ll borrow a bit from the official page to answer it. F# is a universal programming language for writing succinct, robust and performant code. F# allows you to write uncluttered, self-documenting code, where your focus remains on your problem domain, rather than the details of programming. It does this without compromising on speed and compatibility - it is open-source, cross-platform and interoperable. open System // Gets access to functionality in System namespace. // Defines a list of names let names = [ "Peter"; "Julia"; "Xi" ] // Defines a function that takes a name and produces a greeting. let getGreeting name = $"Hello, {name}" // Prints a greeting for each name! names |> List.map getGreeting |> List.iter (fun greeting -> printfn $"{greeting}! Enjoy your F#") Trivia: F# is the language that made the pipeline operator (|>) popular. F# has numerous features, including: Lightweight syntax Immutable by default Type inference and automatic generalization Fir...
First seen: 2025-04-01 12:46
Last seen: 2025-04-02 18:52