Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

add fixed length tuples #11

Open
ffwff opened this issue May 28, 2019 · 0 comments
Open

add fixed length tuples #11

ffwff opened this issue May 28, 2019 · 0 comments
Labels
language-feature Proposal for a new language feature stdlib Related to the standard library

Comments

@ffwff
Copy link
Owner

ffwff commented May 28, 2019

Tuples (fixed-length arrays) should be added.

Syntax

The syntax for defining a tuple would be:

(a, b)

Which creates a tuple with values a and b.

Tuple destructuring into variables/arguments should be added. The syntax for variables would be:

a, b = (0, 1)

Which would set a to 0, and b to 1.

The syntax for functional arguments should be:

function X((a, b)) begin
	return a + b
end

Calling X() with the argument (2, 3) will destructure the tuple into the variables a, b and return the sum 5.

Functions

Tuples can be indexed like arrays and will have map, filter and reduce functions. It should also have an array function to cast it into an array.

An enumerate function should also be added for arrays/tuples which will return an array of tuples containing index-value pairs.

@ffwff ffwff added language-feature Proposal for a new language feature stdlib Related to the standard library labels May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
language-feature Proposal for a new language feature stdlib Related to the standard library
Projects
None yet
Development

No branches or pull requests

1 participant