Functional Data Structures

We are familiar with imperative data structures. In fact, there are lots of references to imperative data structures in different programming languages. In contrast, there aren't many references to declarative data structures or functional data structures. This is because FP languages are not as mainstream as imperative programming languages. Additionally, designing and implementing functional data structures is more difficult in comparison to imperative counterparts because of the following reasons:

  • Mutability is not recommended in FP
  • Functional data structures are expected to be more flexible than their imperative counterparts

Imperative data structures rely heavily on mutability and assignments and making them ...

Get Swift Functional Programming - Second Edition 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.