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

builtin.jq: lpad, nwise/1, nwise/2 #2786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pkoppstein
Copy link
Contributor

lpad: left pad
nwise/1 replaces _nwise/1 and works on arrays and strings. nwise($n; stream) is a stream-oriented version of nwise/1, and places no limits on what may appear in the stream. It has $n as its first argument mainly in deference to limit/2.

_nwise/2 is dropped.

lpad: left pad
nwise/1 replaces _nwise/1 and works on arrays and strings.
nwise($n; stream) is a stream-oriented version of nwise/1, and places no limits on what may appear in the stream.
It has $n as its first argument mainly in deference to limit/2.

_nwise/2 is dropped.

nwise(2)
[]
[]
Copy link
Member

Choose a reason for hiding this comment

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

Add a negative $n test case as it seems to get stuck atm, should throw error?

Copy link
Contributor Author

@pkoppstein pkoppstein Jul 31, 2023

Choose a reason for hiding this comment

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

Good points. QED.

Not sure why the "Building man page...." test fails, as I don't have that problem on a Mac. Any ideas?

@itchyny
Copy link
Contributor

itchyny commented Jul 31, 2023

Let's discuss on the design of padding function(s) in #2033. Especially on how this is less useful on printing strings with multi-width characters in table-like format in terminals.

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

Successfully merging this pull request may close these issues.

3 participants