I can do
for event in linq.Deltas do
or I can do
linq.Deltas |> Seq.iter(fun event ->
So I’m not sure if that is the same. If that is not the same I want to know the difference. I don’t know what to use: iter or for.
added – so if that is the matter of choice I prefer to use iter on a top level and for is for closures
added some later – looking like iter is map + ignore – it’s the way to run from using imperative ignore word. So it’s looking like functional way …
You can modify mutable variables from the body of a
forloop. You can’t do that from a closure, which implies you can’t do that usingiter. (Note: I’m talking about mutable variables declared outside of thefor/iter. Local mutable variables are accessible.)Considering that the point of
iteris to perform some side effect, the difference can be important.I personally seldom use
iter, as I findforto be clearer.