f#-interactive

scripts don't recognize FSharp.Data

烈酒焚心 提交于 2019-12-01 16:15:08
Somewhat of a F# beginner. I'm trying to test out some of my XmlTypeProvider code in the interactive window by first entering it in a script (fsx) file. The script file won't recognize the following open FSharp.Data // gives "The namespace or module 'FSharp' is not defined" Everything has been added to reference, and .fs files seem to not have any problems finding the XmlTypeProvider reference but for some reason, a script in the same project does not. I even got the code to work in a .fs file. I added FSharp.Data with nuget and everything seem to add correctly. What am I missing here? Add a

FSI.exe does not work under Ubuntu 10.10

本秂侑毒 提交于 2019-11-30 21:07:02
Update: Tried November CTP release. Same error message. Forgot to mention that this server has the Ubuntu server edition installed. I don't have this issue on my Ubuntu desktop that runs Desktop 10.10. So I suspected that it could be some command line related libraries missing. After I installed libreadline-dev and libreadline5, the error message disappeared. However, the issue that fsi stuck is still there. Update2: Tried the new Mono 2.8.1. Same FSI stuck issue. Update3: As this issue is very reproducible, I reported it as a bug in fsi.exe to Microsoft. Let's see how it goes. Update4: Got

F# - Display full results in F# interactive window

岁酱吖の 提交于 2019-11-30 18:06:42
Disclaimer: Total F# Newbie question! If I type the following into an F# file in Visual Studio #light let squares = seq { for x in 1 .. 10 -> x * x } printf "%A" squares and run F# interactive on it by highlighting and pressing Alt + Enter , the output in the interactive window is > seq [1; 4; 9; 16; ...] val squares : seq<int> > But I want to see the full sequence i.e. > seq [1; 4; 9; 16; 25; 36; 49; 64; 81; 100] val squares : seq<int> > Is this possible? I'm hoping that there is a setting for this that I've missed. Brian 'seq' is a lazily-evaluated construct; it could be infinite, which is

FSI.exe does not work under Ubuntu 10.10

☆樱花仙子☆ 提交于 2019-11-30 17:08:36
问题 Update: Tried November CTP release. Same error message. Forgot to mention that this server has the Ubuntu server edition installed. I don't have this issue on my Ubuntu desktop that runs Desktop 10.10. So I suspected that it could be some command line related libraries missing. After I installed libreadline-dev and libreadline5, the error message disappeared. However, the issue that fsi stuck is still there. Update2: Tried the new Mono 2.8.1. Same FSI stuck issue. Update3: As this issue is

How to generate the F# type signature similar to FSI in my own code?

纵饮孤独 提交于 2019-11-30 12:18:10
If one uses the F# Interactive Shell (FSI), the inferred expression type ( signature ) is printed to the console along with its value: val it : int * string * float = (42, "Hello F#", 42.0) How can I mimick the same behaviour in my own code, e.g. to get the inferred types as string for a F# expression? I don't need to dynamically evaluate any F# expressions, the expressions are known in compile time and are part of my (static) F# code. I need this feature to be able to mimick the FSI output in LINQPad for my F# demos. Stephen Swensen Using Unquote Unquote has a facility for getting the F#

F# interactive: Reference a project in currently open solution

扶醉桌前 提交于 2019-11-30 10:51:53
I would like to use the F# interactive console with the projects in the currently open solution in Visual Studio 2010. Is there a quick and easy way to add a reference in the F# interactive console to reference projects in the currently open solution? If it's a project you reference often, you can add an 'always' reference to the FSI command line, under Tools->Options->F# Tools->F# interactive options. Add a -r switch like: -r "C:\Users\yaddayadda\MyDll.dll" I've got lines like this at the top of my .fs file: #if INTERACTIVE #r @"C:\path\to\some.dll" #I @"C:\Users\bford\path\to\a\project\in

How to define printfn equivalent in F#

可紊 提交于 2019-11-30 04:07:35
问题 Since I do research with F# (in particular, using F# interactive), I'd like to have switchable "print-when-in-debug" function. I can do let dprintfn = printfn F# interactive says val dprintfn : (Printf.TextWriterFormat<'a> -> 'a) and I can use dprintfn "myval1 = %d, other val = %A" a b whenever I want in my scripts. Now I'd like to define dprintfn differently, so that it would ignore all its arguments yet being syntax-compatible with printfn . How? The closest (yet non-working) variant I have

F# - Display full results in F# interactive window

眉间皱痕 提交于 2019-11-30 02:37:42
问题 Disclaimer: Total F# Newbie question! If I type the following into an F# file in Visual Studio #light let squares = seq { for x in 1 .. 10 -> x * x } printf "%A" squares and run F# interactive on it by highlighting and pressing Alt + Enter , the output in the interactive window is > seq [1; 4; 9; 16; ...] val squares : seq<int> > But I want to see the full sequence i.e. > seq [1; 4; 9; 16; 25; 36; 49; 64; 81; 100] val squares : seq<int> > Is this possible? I'm hoping that there is a setting

F# interactive - how to see all the variables defined in current session

纵饮孤独 提交于 2019-11-30 02:24:03
In F# interactive, how can I see a list of variables/functions defined in this session? Like a function whos() in python or ls() in R? Thanks. You can probably implement this using .NET Reflection - local variables and functions are defined as static properties/methods of types in a single dynamic assembly. You can get that assembly by calling GetExecutingAssembly (in FSI itself) and then browse the types to find all suitable properties. The following is a reasonably working function for getting local variables: open System.Reflection open System.Collections.Generic let getVariables() = let

F# interactive: Reference a project in currently open solution

时间秒杀一切 提交于 2019-11-29 16:08:20
问题 I would like to use the F# interactive console with the projects in the currently open solution in Visual Studio 2010. Is there a quick and easy way to add a reference in the F# interactive console to reference projects in the currently open solution? 回答1: If it's a project you reference often, you can add an 'always' reference to the FSI command line, under Tools->Options->F# Tools->F# interactive options. Add a -r switch like: -r "C:\Users\yaddayadda\MyDll.dll" 回答2: I've got lines like this