These are chat archives for Microsoft/visualfsharp

21st
Feb 2017
Robert Maxton
@robertmaxton42
Feb 21 2017 22:12
so I'm having some trouble with enumerators

I'm trying

use en = dict.getEnumerator()
while (en.MoveNext()) do
  //...

to step through all K/V pairs in a Dictionary

but I'm getting the error "A value must be mutable in order to mutate the contents or take the address of a value type"
Robert Maxton
@robertmaxton42
Feb 21 2017 22:15
Do we have foreach in F#?
Yemi Bedu @ P&R
@pr-yemibedu
Feb 21 2017 22:16
yes, it is the for loop
Robert Maxton
@robertmaxton42
Feb 21 2017 22:16
ah, alright then
that makes things simpler, thanks
On a side note, while I'm asking, is there a better way to just fold over a dictionary?
Without turning into a list first, it's large enough that i'm worried about performance
right now I'm doing an ugly mutable thing