In this chapter, I’ll be taking you through the basics of F#, how it may differ from other languages you’re familiar with, and why you should learn it. We’ll explore some of its great features as well as its potential as a primary programming language in your toolbox. Let’s get started!
F# is a general-purpose programming language that’s designed to build systems that are robust, succinct, and performant across Windows, Mac, and Linux. It has a lightweight syntax, yet a powerful type system and compiler. This makes it a compelling choice for writing applications, as it enables developers to rapidly model real-world systems in a way that does what they intend.
F# is an opinionated language with a set of characteristics that it is optimized toward. What do I mean by this? F# encourages us to write applications using a consistent set of simple constructs such as functions, data, and types in a very low-ceremony fashion compared to many other languages that come from a more classical object-oriented background. Although some of those languages have added in some capabilities to hide some of that complexity, in F#, this has been a core part of its design from day one. As an example, here’s some basic F# code that defines a function: