Sunday, 15 September 2013

f# - Changing an FSharpList in C# -



f# - Changing an FSharpList in C# -

fsharplist<fsharplist<int>> newimagelist; fsharplist<int> row; for(int = 0; < currentimage.header.height) { row = ppmimagelibrary.grayscaleimage(currentimage.imagelistdata); newimagelist.head = row; }

above i'm trying take int list list , set each index row int list. can't .head, , if alter first index. i'm wondering how perchance create work, i'm having hard time getting index of newimagelist in first place.

fsharplist immutable list. hence cannot assign head , tail properties something. however, can seek adding fsharp list generic c# list or collection inherits ienumerable. illustration code:

list<int> newimagelist = new list<int>(); for(int = 0; < currentimage.header.height) { newimagelist.addrange(ppmimagelibrary.grayscaleimage(currentimage.imagelistdata)); // assuming grayscaleimage method might homecoming multiple records. }

i hope helps.

c# f# c#-to-f#

No comments:

Post a Comment