Questions tagged [f#-3.1]

F# 3.1 is the released version of the F# functional language in the VS2013 timeframe

The focus of this version of the F# language is to make incremental improvements to improve the software engineering qualities of the language and make it simpler to use in common situations.

Blog post of the prerelease.

14 questions
11
votes
1 answer

Module and class with same name

This is allowed: type Test = class end [] module Test = begin end But this not: [] module Test =…
Nikon the Third
  • 2,771
  • 24
  • 35
10
votes
1 answer

How to put a literal percent sign (%) inside F#'s printf format strings?

I want to print a % sign using F#'s printfn function. After googling the format syntax, this should do the trick: printfn "%%". Apparently not... F# interactive output: > printfn "%%";; %% val it : unit = () Weird... I'm using F#3.1 and .NET 4.5,…
Nikon the Third
  • 2,771
  • 24
  • 35
8
votes
2 answers

Why does the F# compiler not create a tail call for this function?

I'm having trouble with the fixed point combinator in F#: let rec fix f a = f (fix f) a fix (fun body num -> if num = 1000000 then System.Console.WriteLine "Done!" else body (num + 1) ) 0 (This code is just to demonstrate the…
7
votes
2 answers

How to make F# projects which will work same on VS2010 / VS2013-preview?

New F# projects comes with
cnd
  • 32,616
  • 62
  • 183
  • 313
5
votes
2 answers

Using F# and Caliburn.Micro Together

As I understand Caliburn.Micro does a considerable amount of auto-wiring and plumbing for a WPF project in a convention-based manner; employing MVVM. Question: Are there any C# specific parts in Caliburn.Micro; which used some C#-only features? What…
Kaveh Shahbazian
  • 13,088
  • 13
  • 80
  • 139
5
votes
1 answer

Compiled form of named union fields in v3.1

Firstly, is the F# 3.1 spec available online? If so, the answer for this should be easy enough to find. I'm wondering if the compiled form of discriminated unions with named fields (added in 3.1) will include properties with the names of the fields,…
Daniel
  • 47,404
  • 11
  • 101
  • 179
3
votes
2 answers

F# error with sprintf and format

Im using a resource file for strings, and then use also those with placeholders and needs to format the strings. I have (about) the following code in my project: let create s = sprintf (Printf.StringFormat<_>(s)) let formatstring = "%s:%d" // this…
Helge Rene Urholm
  • 1,190
  • 6
  • 16
3
votes
0 answers

When does F# do constant folding?

I just wrote some inlined maths utility functions and, while testing, noticed that let quat = (3, 0, 0, 3) (quat |||~||| quat) |> ijk |> printAn is completely folded into printAn (18, 0, 0) while starting with (3.0f, 0.0f, 0.0f, 3.0f) only inserts…
Tamschi
  • 1,089
  • 7
  • 23
2
votes
1 answer

Why are F# closures serializable?

Why do F# closures have the [] attribute? What would be a practical use case? This code demonstrates serializing and deserializing a closure: open System open System.IO open System.Runtime.Serialization.Formatters.Binary let formatter…
Nikon the Third
  • 2,771
  • 24
  • 35
2
votes
1 answer

F# projects in Visual Express 2013 Desktop

I've found information it's possible to use F# in VE 2013 Desktop: http://fsharp.org/use/windows/ I've installed both VE 2013 Desktop and F# Tools (using the links above), but when I launch the application I can't create F# projects - there are only…
LA.27
  • 1,888
  • 19
  • 35
1
vote
1 answer

IntPtr and UIntPtr literals

I tried creating a literal for HWND_BROADCAST ((HWND)0xffff), which is marshalled as an IntPtr. let [] HWND_BROADCAST = 0xFFFFn Visual Studio tells me: error FS0267: This is not a valid constant expression or custom attribute value. Very…
Nikon the Third
  • 2,771
  • 24
  • 35
1
vote
1 answer

Where is the source code of F# 3.1.2?

I'm trying to build F# myself, the official instructions include cloning the repo: git clone https://github.com/fsharp/fsharp. But if you look at the master branch of the repo, you'll see it is still version 3.1.1.25, for example as stated in…
Nikon the Third
  • 2,771
  • 24
  • 35
1
vote
0 answers

Disable type providers in project

I am developing a Type Provider. I have a Test-Project where I have enabled the use of the type provider (by clicking "Enable" in the confirmation box that appears when you first add a reference to a type provider assembly). Now I want to test the…
Nikon the Third
  • 2,771
  • 24
  • 35
1
vote
2 answers

"new" keyword causing red squiggle

I wonder what's going on here... I just created a new, empty F# Console application in Visual Studio 2013 (using F# 3.1 and .NET 4, FSharp.Core Version 4.3.1.0) and added the Reactive Extensions Main Library using Nuget: Install-Package Rx-Main Now…
Nikon the Third
  • 2,771
  • 24
  • 35