f#-data

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

Changing an immutable object F#

大憨熊 提交于 2019-11-30 13:39:59
I think the title of this is wrong but can't create a title that reflects, in the abstract, what I want to achieve. I am writing a function which calls a service and retrieves data as a JSON string. The function parses the string with a JSON type provider . Under certain conditions I want to amend properties on that JSON object and then return the string of the amended object. So if the response from the call was {"property1" : "value1","property2" : "value2", "property3": "value3" } I want to change property3 to a new value and then return the JSON string. If the JsonProvider was mutable this

Merge multiple lists of data together by common ID in F#

依然范特西╮ 提交于 2019-11-29 10:25:19
I have multiple lists of data from 4 different sources with a common set of IDs that I would like to merge together, based on ID, basically ending up with a new list, one for each ID and a single entry for each source. The objects in the output list from each of the 4 sources look something like this: type data = {ID : int; value : decimal;} so, for example I would have: let sourceA = [data1, data2, data3]; let sourceB = [data1, data2, data3]; let sourceC = [data1, data2, data3]; let sourceD = [data1, data2, data3]; (I realize this code is not valid, just trying to give a basic idea... the

Merge multiple lists of data together by common ID in F#

淺唱寂寞╮ 提交于 2019-11-28 03:35:32
问题 I have multiple lists of data from 4 different sources with a common set of IDs that I would like to merge together, based on ID, basically ending up with a new list, one for each ID and a single entry for each source. The objects in the output list from each of the 4 sources look something like this: type data = {ID : int; value : decimal;} so, for example I would have: let sourceA = [data1, data2, data3]; let sourceB = [data1, data2, data3]; let sourceC = [data1, data2, data3]; let sourceD