Programming is the art of solving problems by writing a program to be executed by a computer, and this book has been written as an introduction to programming for novice programmers.
This book uses F#, also known as Fsharp, which is a functional-first programming language, meaning that it is designed as a functional programming language that also supports imperative and object-oriented programming. It was originally developed for Microsoft's .Net platform but is available as open source for many operating systems through Mono. As an introduction to programming, F# is a young programming language still under development, with syntax that at times is a bit complex. Still, it offers many advantages:
- Interactive and compile mode: F# has an interactive and compile mode of operation. In interactive mode, you can write code that is executed immediately like working with a calculator, while in compile mode you combine many lines of code possibly in many files into a single application, which is easier to distribute to people who are not F# experts and is faster to execute.
- Indentation for scope: F# uses indentation to indicate scope. Some lines of code belong together and should be executed in a certain order and may share data. Indentation helps in specifying this relationship.
- Strongly typed: F# is strongly typed, reducing the number of runtime errors. That is, F# is picky, and will not allow the programmer to mix up types such as numbers and text. This is a great advantage for large programs.
- Multi-platform: F# is available on Linux, Mac OS X, Android, iOS, Windows, GPUs, and browsers both via the public domain Mono platform and Microsoft's open-source .Net system.
- Free to use and open source: F# is supported by the Fsharp foundation (https://fsharp.org) and sponsored by Microsoft.
- Assemblies: F# is designed to be able to easily communicate with other .Net and Mono programs through the language-independent, platform-independent byte code called Common Intermediate Language (CIL) organized as assemblies. Thus, if you find that certain parts of a program are easy to express in F# and others in C++, then you will be able to combine these parts later into a single program.
- Modern computing: F# supports all aspects of modern computing including Graphical User Interfaces, Web programming, Information-rich programming, Parallel algorithms, ...
- Integrated development environments (IDE): F# is supported by IDEs such as Visual Studio (https://www.visualstudio.com) and Xamarin Studio (https://www.xamarin.com).
It is used in the first programming course at the University of Copenhagen's bachelor in computer science program.
The complete manuscript is here: fsharpNotes. The individual chapters can also be accessed below, without cross-references:
-
FrontMatter
-
Part I Getting Started
-
Part II Declarative Programming Paradigm
-
Part III Imperative Programming Paradigm
-
Appendices
-
Backmatter
Copyright © 2015 Jon Sporring All rights reserved. No part of this book may be reproduced in any form without permission from the author or publisher.
To request permission, contact Jon Sporring at [email protected]