f#-3.0

Code coverage using dotCover throws an error - FAKE F#MAKE

血红的双手。 提交于 2020-01-25 21:26:28
问题 I am trying to use DotCover in FAKE , but it is throwing some error , as I am new to FAKE as well as F# , it's becoming difficult for me to understand the root cause of the problem . Here is the code : #r "D:/FAKEProject/Fake/packages/FAKE/tools/FakeLib.dll" open Fake open Fake.DotCover let testDir = "D:/FAKEProject/Fake/test/" let filters = "" Target "Clean" (fun _ -> CleanDirs [testDir] ) Target "TestCoverage" (fun _ -> !! ("D:/FAKEProject/Fake/UnitTest/UnitTest.dll") |> DotCoverNUnit (fun

Accessing dynamic property in F#

与世无争的帅哥 提交于 2020-01-03 18:45:27
问题 I was trying to access dynamic property in Nancy. In Nancy if pass parameter in query it comes as dynamic property. How can I access that. There are many discussion / question about this but every where, first it is of creating dynamic and then consuming it. How can I consume what is already created? Here are two code snippet public class ParameterModule : NancyModule { public ParameterModule():base("/{about}") { this.Get["/"] = (parameters) => "Hello About" + parameters.about; } } and for F#

F# Immutable data structures for high frequency real-time streaming data

别说谁变了你拦得住时间么 提交于 2019-12-31 22:31:32
问题 We are at the beginning of an f# project involving real-time and historical analysis of streaming data. The data is contained in a c# object (see below) and is sent as part of a standard .net event. In real-time, the number of events we typically receive can vary greatly from less than 1/sec to upwards of around 800 events per second per instrument and thus can be very bursty. A typical day might accumulate 5 million rows/elements per insturment A generic version of the C# event's data

F# Immutable data structures for high frequency real-time streaming data

好久不见. 提交于 2019-12-31 22:31:08
问题 We are at the beginning of an f# project involving real-time and historical analysis of streaming data. The data is contained in a c# object (see below) and is sent as part of a standard .net event. In real-time, the number of events we typically receive can vary greatly from less than 1/sec to upwards of around 800 events per second per instrument and thus can be very bursty. A typical day might accumulate 5 million rows/elements per insturment A generic version of the C# event's data

Active pattern broken in F# 3.0

谁都会走 提交于 2019-12-30 17:38:43
问题 This active pattern compiles with F# 2.0: let (|Value|_|) value = // 'a -> 'T option match box value with | :? 'T as x -> Some x | _ -> None but, in F# 3.0, emits the error: Active pattern '|Value|_|' has a result type containing type variables that are not determined by the input. The common cause is a [sic] when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice = A x' I tried: let (|Value|_|) value

F# Data: JSON Parser. Using JsonExtensions

核能气质少年 提交于 2019-12-23 16:19:17
问题 It is my first question on SO...so do not judge strictly =) Usually all my questions techout in chat rooms (believe me, a lot of them =)). Recently, we are talking about the RosettaCode. And I wondered to complement some of the tasks code to F# One of them is JSON. One of the possible solutions is the use of "F# Data: JSON Parser". So my question is linked with it. This code works well: open FSharp.Data open FSharp.Data.JsonExtensions type Person = {ID: int; Name:string} let json = """[ { "ID

Which defferences “Seq” with “seq” ?

≡放荡痞女 提交于 2019-12-23 12:15:05
问题 I'm worried when don't know when you can use "Seq" , "seq" . Can you tell me which defferences are ? This's my code . Why dont't use "seq" ? let s = ResizeArray<float>() s.Add(1.1) s.Add(2.2) s.Add(3.3) s.Add(4.4) s |> Seq.iter (fun x -> printfn("%f") x ) 回答1: Seq is a module that contains functions that work with seq values: Seq.map string [ 1; 2 ] Seq.sum [ 1; 2 ] seq is a type name: let f1 (xs : seq<int>) = () let f2 (xs : int seq) = () seq is also a function that converts something like a

Is F# 3.0 runtime redistributable? [closed]

梦想与她 提交于 2019-12-23 07:57:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is legally OK to redistribute F# 3.0 runtime (FSharp.Core.dll versions 2.3.0.0, 4.3.0.0), and where do I find proof of that? I prepared a NuGet package with those but having second thoughts about licensing before publishing the package. Microsoft released F# 2.0 runtime as a redist package - so no questions

Bitmap image manipulation

流过昼夜 提交于 2019-12-20 02:39:10
问题 I want to replace GetPixel and SetPixel using LockBits method, so I came across this F# lazy pixels reading open System.Drawing open System.Drawing.Imaging let pixels (image:Bitmap) = let Width = image.Width let Height = image.Height let rect = new Rectangle(0,0,Width,Height) // Lock the image for access let data = image.LockBits(rect, ImageLockMode.ReadOnly, image.PixelFormat) // Copy the data let ptr = data.Scan0 let stride = data.Stride let bytes = stride * data.Height let values : byte[]

groupby multiple columns in a F# 3.0 query

我怕爱的太早我们不能终老 提交于 2019-12-18 11:00:34
问题 Just trying out F# 3.0 and hit a bit of a wall when it comes to grouping by multiple columns. The obvious thing to try was query { for d in context.table do groupBy (d.col1,d.col2) into g select (g.Key) } But I get a "Only parameterless constructors and initializers are supported in LINQ to Entities." exception. I can't seem to find an example on msdn http://msdn.microsoft.com/en-us/library/hh225374(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/hh361035(v=vs.110).aspx And I realize