(no title)
nathankleyn | 9 years ago
You can define Swift enumerations to store associated values of any given type, and the value types can be different for each case of the enumeration if needed. Enumerations similar to these are known as discriminated unions, tagged unions, or variants in other programming languages. [1]
Haskell and other ML family languages also have similar constructs, although these are usually modelled using "Algebraic Data Types", or "sum types". [2] [3]
[1]: https://developer.apple.com/library/content/documentation/Sw...
[2]: https://wiki.haskell.org/Algebraic_data_type
[3]: https://www.schoolofhaskell.com/school/to-infinity-and-beyon...
No comments yet.