We will start by introducing Visual Studio as the main tool of choice for this book. Although it's possible to use the standalone F# compiler and your favorite editor, you will most likely be more productive using Visual Studio 2012, as we will do throughout this book.
F# has been a part of Visual Studio since 2010. We will use the latest version of Visual Studio and F# throughout this book. This will enable us to use the latest functionality and enhancements available in Visual Studio 2012 and F# 3.0.
F# is open source, which means you can use it on any supported platform; it's not bound to Microsoft or Visual Studio. There is good support in other IDEs, such as MonoDevelop, which will run on Linux and Mac OS X.
Note
For more information about F# and the F# Software Foundation, visit http://fsharp.org.
Create a new project in Visual Studio for F#, which is to be used in this guide to explore the basics, as shown in the following sections.
Using the following steps, we can create a new project in Visual Studio:
To create your first F# project, open Visual Studio 12 and navigate to File | New | Project, then, from the menu select New Project.
Now you will see the New Project window appear. Select F# in the left panel and then select F# Application. You can name it anything you like. Finally, click on OK.
Now you have created your first F# application, which will just print the arguments passed to it.
Let's have a brief look at the program template generated by Visual Studio.
If you run this program, which will just print out the arguments passed to it, you will see a terminal window appear.
The [<EntryPoint>]
function in the preceding screenshot is the main function, which tells Visual Studio to use that particular function as the entry point for the program executable. We will not dig any deeper into this program template for now, but we will come back to this in the last three chapters when we'll build the trading system.
We will use an F# script file after having looked at the standard program template instead of exploring the basics of the language in a more interactive fashion. You can think of F# script files as notebooks, where you have executable code that you can explore in pieces in an incremental style:
Now that we have set up the basic project structure in Visual Studio, let's continue and explore F# Interactive.