Immutable Data
The bread-and-butter of functional programming is immutable data types.
We have already seen several examples of immutable data types:
In addition, The Flix standard library offers several immutable data types:
List[t]: An immutable singly-linked list of elements of typet.Chain[t]: An immutable chain of elements of typetwith fast append.Vector[t]: An immutable sequence of elements of typetwith fast lookup.Set[t]: An immutable set of elements of typet.Map[k, v]: An immutable map of keys of typekto values of typev.
Other immutable data types include:
Option[t]: A type that is eitherNoneorSome(t).Result[e, t]: A type that is eitherOk(t)orErr(e).Nel[t]: An immutable non-empty singly-linked list of elements of typet.Nec[t]: An immutable non-empty sequence of elements of typetthat supports fast append.MultiMap[k, v]: An immutable map of keys of typekto sets of values of typev.