3.6. FuncProg Immutable¶
3.6.1. Rational¶
Purely functional data structures have persistence (keeps previous versions of the data structure unmodified)
The array with constant access and update times is a basic component of most imperative languages, and many imperative data-structures, such as the hash table and binary heap, are based on arrays
Arrays can be replaced by maps or random access lists, which admit purely functional implementation, but have logarithmic access and update times
Source: 1
3.6.2. Mutable vs Immutable¶



3.6.3. Changes¶

3.6.4. Immutable Types¶
int
float
complex
bool
None
str
bytes
tuple
frozenset
mappingproxy
3.6.5. Mutable Types¶
list
set
dict
3.6.6. Comparison¶
Immutable |
Mutable |
---|---|
int |
|
float |
|
complex |
|
bool |
|
None |
|
str |
|
bytes |
bytearray |
tuple |
list |
frozenset |
set |
mappingproxy |
dict |
NamedTuple |
|
namedtuple |
|
array |
|
TypedDict |
|
dataclass |
dataclass |
3.6.7. References¶
- 1
Functional programming. Retrieved: 2020-10-09. URL: https://en.wikipedia.org/wiki/Functional_programming