Chapter 6. Other Unique Features

In previous chapters, I showed you exciting things you can do in F# as well as various F# data structures. This chapter itemizes the F# data structures and describes them in detail. This chapter is crucial to starting your F# development in full swing.

Working with Reference Cells

You already used the reference cell in Example 1-86 from Chapter 1. In that code, a reference cell was used to wrap a ref parameter. According to the MSDN documentation, a reference cell is a storage structure used to create mutable data. The reference cell definition is shown in Example 6-1, which is actually a record type containing a mutable variable.

Example 6-1. Reference cell definition
type Ref<'a> =
    { mutable contents: 'a }

This is ...

Get F# for C# Developers 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.