Автор: Ian Russell
Издательство: Leanpub
Год: 2023-01-30
Страниц: 207
Язык: английский
Формат: pdf (true), epub, mobi
Размер: 10.2 MB
This is a practical book aimed at efficiently getting you up to speed with the essentials of functional-first programming in F#. It will help you to discover why F# is such a popular language with those who have spent time learning its secrets.
This book is targeted at folks wanting to learn F# and assumes that the reader has no real knowledge of F# or functional programming. Some programming experience, particularly in C# or VB.NET, may be useful but not absolutely necessary. Although F# has often been portrayed as a functional programming language, it isn’t, and neither is this book purely about functional programming. You are not going to learn about Category Theory, Lambda Calculus, or even Monads. You will learn things about programming in a functional-first style as a by-product of how we solve problems with F#. What you will learn is how F#’s functional-first approach to programming empowers everyone to write succinct, robust, and performant code. You will learn a lot of new terminology as you read this book but only enough to understand the features of F# that allow us to solve real-world problems with clearly expressed and concise code. What you will take away most from this book is an understanding of how F# supports us by generally making it easier for us to write code the F# way than it is to be a functional programming purist.
For many historical reasons, functional programming has been viewed as difficult to learn and not very practical by most .NET developers. Functional programming is too often regarded as being too steeped in mathematics and academia to be of any use for writing the everyday line of business applications that most of us work on. This book is designed to help dispel those impressions. So the obvious question to ask is:
What is F# good for?
Whilst it’s great for many things like web programming, cloud programming, Machine Learning, AI, and Data Science, the most accurate answer comes from a long-standing F# Community member Dave Thomas:
“F# is good for programming”
F# is a general-purpose language for the .NET platform along with C# and VB.NET. F# has been bundled with Visual Studio, and now the .NET SDK, since 2010. The language has been quite stable since then. Code written in 2010 is not only still valid today but is also likely to be stylistically similar to current standards.
Why would you choose F# over another language? I noticed a question from cancelerx on Twitter:
“I would like to do a lightning talk on F#. My team is primarily PHP and Python devs. What should I showcase? I want to light a spark.”
My response was:
The expressive type system, composition with the forward pipe operator, pattern matching, collections, and the REPL. I’ve been thinking about my answer and whilst I still think that the list is a good one, I think that I should have said that it is how the various features work together that makes F# so special, not the individual features themselves. It feels like a well-thought-out language that doesn’t have features just because other languages have them.
F# supports many paradigms, such as imperative and object-oriented programming but we will concentrate on how it encourages functional-first programming. My view of the choices F# has made in its language design can be summed up quite easily:
I enjoy functional programming but I like programming in F# even more.
I’m not alone in feeling like this about F#. I hope that this book is a useful step on a similar journey to the one that I’ve been on.
Скачать Essential F#: Succinct, Robust, Performan