-
-
Notifications
You must be signed in to change notification settings - Fork 4
tuple
Pannous edited this page Mar 22, 2022
·
2 revisions
A tuple is a list with fixed length and fixed size. A named tuple is a map with fixed keys, length and size.
Because of these properties addition of tuples is element wise: ( 1 2 3 ) + ( 4 5 6 ) == (5 7 9)
This is an important distinction to lists where {1 2 3 } + { 4 5 6 } == {1 2 3 4 5 6 }
Unlike in some other languages, tuples in angle can be both mutable and immutable (constant final).
x=( 1 2 3 ) x[0]=0 (0 2 3)
https://github.com/tc39/proposal-record-tuple Record, a deeply immutable Object-like structure #{ x: 1, y: 2 } Tuple, a deeply immutable Array-like structure #[1, 2, 3, 4]