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

add skip/2 as the counterpart to limit/2 #3181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

itchyny
Copy link
Contributor

@itchyny itchyny commented Sep 22, 2024

This PR implements skip/2 as the counterpart of limit/2. I also changed the behavior of limit/2 with negative count to emit an error, like nth/2 does. Also, I redefined nth/2 using skip/2 to minimize the impact of growth of builtin filters.

@itchyny itchyny force-pushed the add-skip-2 branch 4 times, most recently from f758f3e to 03fa79c Compare September 22, 2024 06:24
Copy link
Member

@wader wader left a comment

Choose a reason for hiding this comment

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

Like it 👍

BTW i'm looking at #3179 but i'm new to the jq vm so taking some times to understand it

wader added a commit to wader/jaq that referenced this pull request Sep 24, 2024
`[[]] | implode` crash was fixed in 1.7 by jqlang/jq#2646
`[limit(0; 1, 2, 3)]` yielding 1,2 instead of nothing fixed in 1.7 by jqlang/jq#2316
`limit/2` will throw error on negative limit once jqlang/jq#3181 is merged
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.

2 participants