I don't understand why I'm getting the error below:
> let x = "ABCDAACCECFG"|>Seq.sort|>Seq.groupBy (fun x->x);;
val x : seq<char * seq<char>>
> x;;
val it : seq<char * seq<char>> =
seq
[('A', seq ['A'; 'A'; 'A']); ('B', seq ['B']);
('C', seq ['C'; 'C'; 'C'; 'C']); ('D', seq ['D']); ...]
> (x|> Seq.head).GetType();;
val it : System.Type =
System.Tuple`2[System.Char,System.Collections.Generic.IEnumerable`1[System.Char]]
{Assembly = mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;
AssemblyQualifiedName = "System.Tuple`2[[System.Char, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Collections.Generic.IEnumerable`1[[System.Char, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
...
DeclaredProperties = [|Char Item1;
System.Collections.Generic.IEnumerable`1[System.Char] Item2;
Int32 System.ITuple.Size|];
...;}
> x|> Seq.map (fun x -> x.Item1, x.Item2)|>dict;;
x|> Seq.map (fun x -> x.Item1, x.Item2)|>dict;;
------------------------^^^^^
stdin(123,25): error FS0039: The field, constructor or member 'Item1' is not defined.
It appears to me that x is a sequence of tuples where each tuple has an Item1 (Char) and Item2 (seq Char) property. I'd like to turn this into a dictionary.
Clearly, I'm missing something. Can anyone help me understand what I'm doing wrong and how to get it right?