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

Minor variable subscripting improvements #82

Open
jpco opened this issue Jan 22, 2024 · 0 comments
Open

Minor variable subscripting improvements #82

jpco opened this issue Jan 22, 2024 · 0 comments

Comments

@jpco
Copy link
Collaborator

jpco commented Jan 22, 2024

More breaking changes -- sorry, sorry. I have two suggestions, both of which I've run into in practical use:

  1. Changing precedence of $$x(2). This was suggested in the mailing list many moons ago (http://wryun.github.io/es-shell/mail-archive/msg00617.html) and had vague support, but never got implemented.

This is the thing where, currently, $$x(2) is the same as $($x(2)), rather than the (not-actually-valid-syntax) $($x)(2). It would be nice if it were the latter, since the former is really easy to make happen.

  1. Changing "reverse" ranges to reverse the elements of the list returned.

This is an XS-ism, but one I find useful. One can easily get at the last element(s) of a list by reversing it with $x($#x ... 1) and then getting the first element(s) of the reversed list. I also think it's arguably more intuitive than the current behavior (that is, if lo > hi, then provide no results), because this correspondence is very natural:

$x(1 ... 3) <=> $x(1 2 3)
$x(2 ... 3) <=> $x(2 3)
$x(3 ... 3) <=> $x(3)
$x(4 ... 3) <=> $x(4 3)
$x(5 ... 3) <=> $x(5 4 3)
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

1 participant