Tag Archives: f#

Replacing the for loop with Seq.iter

Here’s the initial function in C#: public string BuildQuery(IEnumerable<KeyValuePair<string, string>> args) { var coll = HttpUtility.ParseQueryString(String.Empty, _urlEncoder); foreach (var arg in args) { coll.Add(arg.Key, arg.Value); } return coll.ToString(); } First I rewrote it in F# the following pretty na├»ve way, … Continue reading

Posted in Programming | Tagged | Leave a comment