Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple unpacking #6

Open
gustavwilliam opened this issue Dec 23, 2020 · 2 comments
Open

Tuple unpacking #6

gustavwilliam opened this issue Dec 23, 2020 · 2 comments

Comments

@gustavwilliam
Copy link
Member

We need a way to unpack tuples and add them to the stack. The following is the proposed syntax:

( 1 2 3 ) unpack
( 1 2 3 ) :tpl var
tpl unpack

Both of the examples above would give the following result. The values 1, 2 and 3 would be added to the stack — in that order.

@lavirlifiliol
Copy link
Contributor

this can now be done with the case function like

(1 2 3) { ((. . .)) {} } case  # 1 2 3 is now on the stack, with 1 on top.
(1 2 3) { ((. .. ...)) {} } case  # 3 2 1 is now on the stack, with 3 on top.

there may still be value in having this as a function though.

@gustavwilliam
Copy link
Member Author

That's very nice to know. I think we should still make the unpack command, since it looks cleaner in some sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants