Tuple
Tuples are simply a finite, ordered sequence of elements.
Construction#
To create new Tuple use named constructor of
which accepts a variable number of arguments:
Tuple implements built-in ArrayAccess interface. This will allow to use it like normal array:
Tuples in Munus are immutable. This means that the assignment instruction will end with an exception:
Methods#
arity(): int- returns the number of elements in this tupletoArray(): array- converts tuple to php classic arrayappend($value): self- appends new $value to the end and returns new Tupleconcat(self $tuple): self- merge one tuple with other tuple and returns new oneapply(callable $transformer)- transforms tuple with given $transformer, transformer will receive array in the argumentmap(callable $mapper): self- maps tuple to other tupleequals(self $tuple): bool- return true if given tuple contains identical values in identical order