f#

Why am I getting F# error FS0039: The namespace or module 'Http' is not defined

与世无争的帅哥 提交于 2020-01-15 03:46:09
问题 In Visual Studio 2015 and 2017, I'm trying out the Http class from several F# examples in FSharp Interactive, and I keep getting: error FS0039: The namespace or module 'Http' is not defined Here's the sample: open FSharp.Data let response = Http.RequestString("http://api.themoviedb.org/3/search/movie", silentHttpErrors = true) This is clearly due to the version of FSharp.Data. Is there a way to specify the correct version for FSharp Interactive? What version of FSharp.Data contains the Http

Object Browser can't browse my own solution?

被刻印的时光 ゝ 提交于 2020-01-15 03:07:08
问题 When I click on "My Solution" nothing comes up. I have to use Custom Component Set. When I try to add a project from the solution, it can't add it. "The following components could not be browsed." ...projectnamehere I have to browse for the .dll directly. Also, not all the /// comments are showing up. 回答1: This is a limitation of Visual Studio; some features were cut due to time constraints: http://connect.microsoft.com/VisualStudio/feedback/details/541514/object-browser-doesnt-open-an-f-dll

F# sequence operations majorly slow compared to List?

人盡茶涼 提交于 2020-01-14 19:18:08
问题 Used F# List and Seq to merge two sorted lists/sequences. The values are obtained by reading in two files from secondary memory - the results of the file reads are stored in two sequences. Assuming integers are stored for testing purposes, now trying to merge these to print out a sorted series using this code: let rec printSortedSeq l1 l2 = match ( l1, l2) with | l1,l2 when Seq.isEmpty l1 && Seq.isEmpty l2 -> printfn ""; | l1, l2 when Seq.isEmpty l1 -> printf "%d " (Seq.head l2);

FParsec: how to parse date in fparsec (newbie)

▼魔方 西西 提交于 2020-01-14 19:06:48
问题 I am using the Bill Casarin post on how to parse delimited files with fparsec, I am dumbing the logic down to get an understanding of how the code works. I am parsing a multi row delimited document into Cell list list structure (for now) where a Cell is a string or a float. I am a complete newbie on this. I am having issues parsing the floats - in a typical case (a cell delimitted by tabs, containing a numeric) it works. However when a cell happens to be a string that starts with a number -

FParsec: how to parse date in fparsec (newbie)

旧时模样 提交于 2020-01-14 19:06:25
问题 I am using the Bill Casarin post on how to parse delimited files with fparsec, I am dumbing the logic down to get an understanding of how the code works. I am parsing a multi row delimited document into Cell list list structure (for now) where a Cell is a string or a float. I am a complete newbie on this. I am having issues parsing the floats - in a typical case (a cell delimitted by tabs, containing a numeric) it works. However when a cell happens to be a string that starts with a number -

F# using accumulator, still getting stack overflow exception

十年热恋 提交于 2020-01-14 18:49:53
问题 In the following function, I've attempted to set up tail recursion via the usage of an accumulator. However, I'm getting stack overflow exceptions which leads me to believe that the way I'm setting up my function is't enabling tail recursion correctly. //F# attempting to make a tail recursive call via accumulator let rec calc acc startNum = match startNum with | d when d = 1 -> List.rev (d::acc) | e when e%2 = 0 -> calc (e::acc) (e/2) | _ -> calc (startNum::acc) (startNum * 3 + 1) It is my

Populating multiple printf format placeholders with same value

淺唱寂寞╮ 提交于 2020-01-14 18:48:11
问题 Using .NET string formatting you can plug the same value into a format string multiple times: Console.Write("{0}{0}{0}", 1) //prints "111" Is there any way to do this with printf-style formatting, supplying the value only once? 回答1: No. The values are taken in order, from the stack, when passed to the function. If you want multiple appearances of the same value if different parts of the string, you have to supply them in order, multiple times. Think of it this way: you have a string, with

Populating multiple printf format placeholders with same value

强颜欢笑 提交于 2020-01-14 18:45:32
问题 Using .NET string formatting you can plug the same value into a format string multiple times: Console.Write("{0}{0}{0}", 1) //prints "111" Is there any way to do this with printf-style formatting, supplying the value only once? 回答1: No. The values are taken in order, from the stack, when passed to the function. If you want multiple appearances of the same value if different parts of the string, you have to supply them in order, multiple times. Think of it this way: you have a string, with

Operations on sublists

时间秒杀一切 提交于 2020-01-14 15:55:14
问题 I am currently wondering on an approach to split a list in sub-lists according to a given criteria. Because of the didactic purpose of this work, I do not use built-in functions. IE, the following program should, given a list, return a list of lists, where each sub-list does not have duplicates and is in ascending order: increment [4;4;10;20;5;30;6;10] = [[4;10;20];[5;30];[6;10]] increment [5;6;4;3;2;1] = [[5;6];[4];[3];[2];[1]] My best attempt so far is based on this chunk of code I produced

Sandcastle doesn't output everything from a F# assembly

余生长醉 提交于 2020-01-14 14:28:29
问题 It only recognizes top-level non-function value declarations. e.g. let a = 2 and doesn't produce documentation for functions or type definitions. I've checked the xml documentation file and it has all the /// comments I put in the source, but none of them (except for the top level values) show up in the resulting html. 回答1: Yes, using C#-centric tools for F# documentation generation is usually pretty horrible. We started an alternative project a while ago, but it is not yet as mature as