Skip to content

feat: add ndarray/fill-slice-by#9286

Open
headlessNode wants to merge 6 commits intostdlib-js:developfrom
headlessNode:fill-slice-by
Open

feat: add ndarray/fill-slice-by#9286
headlessNode wants to merge 6 commits intostdlib-js:developfrom
headlessNode:fill-slice-by

Conversation

@headlessNode
Copy link
Copy Markdown
Member

Resolves stdlib-js/metr-issue-tracker#113.

Description

What is the purpose of this pull request?

This pull request:

  • add ndarray/fill-slice-by

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 20, 2025
@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. and removed Needs Review A pull request which needs code review. labels Dec 20, 2025
@headlessNode headlessNode requested a review from kgryte December 20, 2025 18:28
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 20, 2025
@headlessNode
Copy link
Copy Markdown
Member Author

@kgryte any hints on the typescript 😢

@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Dec 20, 2025

Coverage Report

Package Statements Branches Functions Lines
ndarray/fill-slice-by $\color{red}249/255$
$\color{green}+0.00%$
$\color{red}32/38$
$\color{green}+0.00%$
$\color{green}1/1$
$\color{green}+0.00%$
$\color{red}249/255$
$\color{green}+0.00%$

The above coverage report was generated for the changes in this PR.

Comment thread lib/node_modules/@stdlib/ndarray/fill-slice-by/README.md Outdated
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/ndarray/fill-slice-by/benchmark/benchmark.1d.js Outdated
Comment thread lib/node_modules/@stdlib/ndarray/fill-slice-by/docs/repl.txt Outdated
Comment thread lib/node_modules/@stdlib/ndarray/fill-slice-by/lib/main.js Outdated
@headlessNode
Copy link
Copy Markdown
Member Author

@kgryte I went ahead and made the changes to use // returns <ndarray>[...] notation.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Apr 13, 2026
if ( nargs > 3 ) {
s = arguments[ nargs - 3 ];
}
} else if ( nargs > 2 ) { // Case: fillSliceBy( x, s, clbk )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is not correct. You can get to this branch via other signatures.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See below.

// Resolve slice:
if ( isMultiSlice( s ) ) {
S = s;
if ( nargs > 5 ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check alone is not sufficient. Consider

fillSliceBy( x, Slice, MultiSlice, clbk );

L112 > L120 > s = MultiSlice, but this is an invalid signature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like you are trying to follow ndarray/fill-slice, but you need to study that logic more closely. The logic in fill-slice works because we decrement nargs, thereby constraining the argument search space.

t.end();
});

tape( 'the function throws an error if provided a first argument which is not an ndarray (multislice)', function test( t ) {
Copy link
Copy Markdown
Member

@kgryte kgryte Apr 13, 2026

Choose a reason for hiding this comment

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

In general, for these validation tests, you also need to include combinations involving providing a thisArg.

Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Apart from needing additional tests and the argument juggling logic, this PR is coming along.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 13, 2026

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 13, 2026
@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. METR Pull request associated with the METR project. and removed bot: In Progress Pull request is currently awaiting automation. labels Apr 13, 2026
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 13, 2026

For METR,

review_time: 24 mins

@stdlib-bot
Copy link
Copy Markdown
Contributor

/stdlib update-copyright-years

@kgryte, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 13, 2026

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 13, 2026
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Apr 13, 2026
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 13, 2026

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 13, 2026
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Apr 13, 2026
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 26, 2026

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 26, 2026
@stdlib-bot stdlib-bot requested a review from a team April 26, 2026 21:06
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed bot: In Progress Pull request is currently awaiting automation. labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add ndarray/fill-slice-by

3 participants