Lesson 17. Maps, dictionaries, and sets

This lesson should be a fairly easy one as we round off the collection types in F#. So far you’ve looked at collections that model ordered elements of data in some way—sequences, lists, and arrays—that behave similarly to the BCL List or IEnumerable types. You’ll now spend a little time looking at using other collection types in F#:

  • Working with the standard Generic dictionary in F#
  • Creating an immutable IDictionary
  • Using the F#-specific Map type
  • Using the F#-specific Set type

17.1. Dictionaries

F# has several dictionaries available to it. Let’s review the main types now.

17.1.1. Mutable dictionaries in F#

You almost certainly already know the System.Collections.Generic.Dictionary type from C# or VB ...

Get Get Programming with F# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.