In C# I could build a Dictionary<string, List<string>> pretty easy. If I was reading through a large database of items I could do the following:
var dict = new Dictionary<string, List<string>>();
foreach(string[] row in data)
if (!dict.ContainsKey(row[0]))
dict.add(row[0], new List<string>() { row };
else
dict[row[0]].add(row);
Now the question is, how do I do this in f# with an immutable Map<string, string list>?
1 Answer