Skip to content

Clarify meaning of $& #293

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

Merged
merged 1 commit into from
Apr 13, 2025
Merged

Conversation

sogaiu
Copy link
Collaborator

@sogaiu sogaiu commented Apr 9, 2025

This PR is a suggestion to clarify the meaning of $& as currently expressed on the function page:

Similarly, $0, $1, etc. refer to the arguments at index 0, 1,
etc. and $& refers to all passed arguments as a tuple.

IIUC, when $, $0, ..., $i is/are used, $& refers to less than "all passed arguments":

(|[$0 $1 $&] 1 0 -1)
# =>
[1 0 [-1]]

(|[$ $&] 1 0)
# =>
[1 [0]]

The suggested change is to express the above as:

Similarly, $0, $1, etc. refer to the arguments at index 0, 1,
etc. and $& refers to all remaining arguments as a tuple.

i.e. saying "all remaining arguments" instead of "all passed arguments".

Copy link
Member

@pepe pepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bakpakin bakpakin merged commit a6d3ecf into janet-lang:master Apr 13, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants