csharpfftfsharpintegrationinterpolationlinear-algebramathdifferentiationmatrixnumericsrandomregressionstatisticsmathnet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.6 KiB
88 lines
3.6 KiB
<html>
|
|
|
|
<head>
|
|
<title>The F# Compiler Version 1.9.6.16</title>
|
|
|
|
<link type="text/css" rel="Stylesheet" href="/rmcstyle.css"><link type="text/css" rel="Stylesheet" href="rmcstyle-copy.css">
|
|
<link type="text/css" rel="Stylesheet" href="/groupStyle.css"><link type="text/css" rel="Stylesheet" href="groupStyle-copy.css">
|
|
|
|
<style type="text/css">
|
|
TT { font-weight: bold; color: blue; font-size: 10pt; }
|
|
PRE { font-weight: bold; color: blue; font-size: 10pt; }
|
|
</style>
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
<h1> Using F# Interactive in Visual Studio</h1>
|
|
|
|
<p>
|
|
If you use Visual Studio 2008 (including the
|
|
freely available <a href="http://msdn.microsoft.com/en-us/vsx2008/products/bb933751.aspx">Visual Studio 2008 Shell</a>),
|
|
you can use 'F# Interactive' as a tool window! </p>
|
|
|
|
<h4>Starting F# Interactive</h4>
|
|
|
|
<p> To start the session, go to the View -> Other Windows and select 'F# Interactive'. You can also start a session
|
|
simply using <tt>Alt-Return</tt> in an F# source document, or using the shortcut Ctrl+Alt+F.</p>
|
|
|
|
|
|
<h4>Editing and Evaluating a Script</h4>
|
|
|
|
<p>You create a script file using File -> New File -> Script -> F# Script File.</p>
|
|
|
|
<p> The normal mode of operation is to edit an F# script file and send fragments for execution in the tool window. In
|
|
this mode, your fragments are typechecked as you type, and you are actively working towards a completed
|
|
file that can act as the finished product of your explorative programming. The tool window is then
|
|
just used for displaying data.</p>
|
|
|
|
<p>In the script file, you should use <tt>#r</tt> and <tt>#I</tt> to reference assemblies
|
|
and augment your assembly include path.</p>
|
|
|
|
|
|
<p>The session is global to the instance of Visual Studio and text can be sent from any
|
|
F# source code file (.fs, .fsi, .fsx, .ml, .mli).
|
|
Use the <tt>Alt-Return</tt> combination to evaluate
|
|
selected text. For example, highlight <tt>printfn "Hello World"</tt> and use this key combination - the code will then
|
|
execute. </p>
|
|
|
|
|
|
<h4>Execution Context for Scripts</h4>
|
|
|
|
|
|
<p>The F# Interactive session executes only those code fragments you direct it to. If you select a fragment from
|
|
half-way through your script, earlier portions of the script will not be executed implicitly. </p>
|
|
|
|
<p>When sending text from a file, file names are resolved relative to the scripts containing the reference. Visual F# Interactive sets the
|
|
line and directory context of the session each time an entry is sent from Visual Studio, though it doesn't
|
|
adjust the value of <tt>System.Environment.CurrentDirectory</tt>. It can be useful to add </p>
|
|
<pre>
|
|
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
|
|
</pre>
|
|
<p>to your script. <tt>__SOURCE_DIRECTORY</tt> can be used in any F# source file and is expanded to the directory
|
|
containing the file.</p>
|
|
|
|
|
|
<h4>Organizing Your Scripts</h4>
|
|
|
|
<p> Although scripts can be authored without a project, it can be useful to create an F# Project to hold a group of related scripts.
|
|
You can do this with <tt>New Project</tt> or by making a copy of one of the projects in
|
|
the F# Samples directory. You can also use <tt>#load</tt> to load both signature and implementation files as
|
|
if they have been compiled as compilation units by the command-line compiler.</p>
|
|
|
|
|
|
<h4>Controlling the Evaluation Session</h4>
|
|
|
|
<p>In the tool window, <tt>#quit;;</tt> will quit and Ctrl+C will cancel execution.
|
|
The context menu in the tool window includes
|
|
"Reset Session" and "Cancel Evaluation" commands.
|
|
If you do type into the tool window, history is available with the up/down arrows. </p>
|
|
|
|
|
|
<p> To troubleshoot, see README-fsharp.html</p>
|
|
|
|
<p>Please contact fsbugs@microsoft.com with feedback on this documentation.</p>
|
|
|
|
</body>
|
|
</html>
|