f#

No exact match installing Mono.Cecil nuget package

拟墨画扇 提交于 2019-12-13 03:30:48
问题 In VS2013.4, when I try to add Mono.Cecil nuget package in my fsharp project : PM> Install-Package Mono.Cecil Installing 'Mono.Cecil 0.9.5.4'. Successfully installed 'Mono.Cecil 0.9.5.4'. Adding 'Mono.Cecil 0.9.5.4' to Ying.Unit. No exact match found for removing reference 'Mono.Cecil.Mdb'. Trying case-insensitive search... Failed to find match for removing reference 'Mono.Cecil.Mdb'. No exact match found for removing reference 'Mono.Cecil.Pdb'. Trying case-insensitive search... Failed to

How can I get the cube root in F#

六眼飞鱼酱① 提交于 2019-12-13 03:14:20
问题 I tried to get the cube root in F#. But here is my problem. let x5 = ((float 64) ** (1.0/3.0));; val x5 : float = 4.0 int x5;; //expected 4 val it : int = 3 The result should be 4, not 3. What's wrong? 回答1: Nothing is wrong, the thing is that the value of your x5 is a bit less , than 4.0. You may explicitly see how much less using fsi: let x5 = ((float 64) ** (1.0/3.0)) let err = 4.0 - x5;; val x5 : float = 4.0 val err : float = 4.440892099e-16 回答2: It looks like you may be looking at the

how to solve type constraint mismatch, C# to F#

本小妞迷上赌 提交于 2019-12-13 02:56:28
问题 I'm trying to implement some C# code as F# for a p2p application.. I must admit I don't have full understanding of the p2p implementation and I hope it is irrelevant for fixing the type problem.. All of the p2p library is implemented in C#. The C# implementation: public class TestMessage : Message { public string Text { get; set; } } ... var p = new Peer(); p.Subscribe(new Subscription<TestMessage> { Callback = x => Console.WriteLine(x.Text), }); The basic idea is that the 'p' peer now

f# custom linked list and references

百般思念 提交于 2019-12-13 02:48:50
问题 i am new to this language. In order to try and understand referencing i have tried implementing a simple directed list the freshman college computer science way. type item = { value:float next:ref<item> } type list() = let head:ref<item> = null // tried instantiation so many different ways and it likes none of em let sum i = if i == null then 0 else i.value + sum i.next // constructor not defined? Please tell me why im bad at this 回答1: First of all you try to implement it in some imperative

SqlDataConnection type provider generates massive error with SQL Server 2008 R2

不想你离开。 提交于 2019-12-13 02:36:28
问题 For some reason, I can't create a type provider for a particular database. I have code which looks a bit like this (not the actual database names, obviously): type db1 = SqlDataConnection<"Data Source=SQL_05;Initial Catalog=**DATABASE1**;Integrated Security=true;MultipleActiveResultSets=True"> type db2 = SqlDataConnection<"Data Source=SQL_08;Initial Catalog=**DATABASE2**;Integrated Security=true;MultipleActiveResultSets=True"> type db3 = SqlDataConnection<"Data Source=SQL_10;Initial Catalog=*

How to make a minimal useful implementation of a class that inherits from System.Type?

扶醉桌前 提交于 2019-12-13 02:28:23
问题 open System type SpiralDU = | IntT | StringT | TupleT of SpiralDU list type SpiralTypeToken(metadata: SpiralDU) = inherit Type() member val Metadata = metadata override __.IsDefined(a,b) = base.IsDefined(a,b) override __.GetCustomAttributes(a,b) = base.GetCustomAttributes(a,b) override __.GetCustomAttributes(a) = base.GetCustomAttributes(a) override __.GUID with get() = base.GUID override __.InvokeMember(a,b,c,d,e,f,g,h) = base.InvokeMember(a,b,c,d,e,f,g,h) override __.Module with get() =

Converting a pointer C# type to F#?

最后都变了- 提交于 2019-12-13 02:14:05
问题 I am just a beginner in programing i wish covert some code from C# to F#, I have encotered this code: float[] v1=new float[10] I need to use this pointer to pass to the function: ComputeBuffer<float> bufV1 = new ComputeBuffer<float>(Context, ComputeMemoryFlags.ReadWrite | ComputeMemoryFlags.UseHostPointer, v1); If i creat an array in F# like this: let v1 = [| 1.0..10.0 |] and call now the funaction like this: let bufV1 = new ComputeBuffer<float>(Context, ComputeMemoryFlags.ReadWrite |||

For an F# Type Provider, how do I make a relative path work as a static parameter?

[亡魂溺海] 提交于 2019-12-13 01:29:43
问题 Is there a good way to make a relative path work for both the type provider while programming and msbuild while building? //type AddressBookProto = Froto.Gen.ProtoGen< @"test\addressbook1.proto"> // VS GUI //type AddressBookProto = Froto.Gen.ProtoGen< @"..\test\addressbook1.proto"> // Build type AddressBookProto = Froto.Gen.ProtoGen< @"C:\Users\taggartc\froto\froto\test\addressbook1.proto"> 回答1: You could use #if #if DEBUG //or similar constant type AddressBookProto = Froto.Gen.ProtoGen< @

Why is my precondition being ignored on my Property-based test?

佐手、 提交于 2019-12-13 01:13:54
问题 Why is my precondition being ignored on my Property-based test? The precondition for my test is the following: fun rowCount -> rowCount >= 0 Thus, my actual test is: [<Fact>] let ``number of cells in grid equals rowcount squared`` () = Check.QuickThrowOnFailure <| fun rowCount -> rowCount >= 0 ==> fun rowCount -> rowCount |> createGrid |> Map.toList |> List.length = rowCount * rowCount However, my test continues to fail: Result Message: System.Exception : Falsifiable, after 3 tests (1 shrink)

Cannot emulate F# worker role

白昼怎懂夜的黑 提交于 2019-12-13 01:08:51
问题 I use VisualStudio 2013.4 with Azure .NET SDK 2.5 : File / New Project : Azure Cloud Service Add F# WorkerRole F5 The cloud service cannot start in emulator : [fabric] Role Instance: deployment25(22).AzureCloudService2.WorkerRole1.0 [fabric] Role state Unhealthy [runtime] Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint [runtime] Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint [runtime] Role entrypoint