Skip to content

Conversation

@headlessNode
Copy link
Member


type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:

  • task: lint_filenames status: passed
  • task: lint_editorconfig status: passed
  • task: lint_markdown status: passed
  • task: lint_package_json status: passed
  • task: lint_repl_help status: passed
  • task: lint_javascript_src status: passed
  • task: lint_javascript_cli status: na
  • task: lint_javascript_examples status: passed
  • task: lint_javascript_tests status: passed
  • task: lint_javascript_benchmarks status: passed
  • task: lint_python status: na
  • task: lint_r status: na
  • task: lint_c_src status: na
  • task: lint_c_examples status: na
  • task: lint_c_benchmarks status: na
  • task: lint_c_tests_fixtures status: na
  • task: lint_shell status: na
  • task: lint_typescript_declarations status: passed
  • task: lint_typescript_tests status: passed
  • task: lint_license_headers status: passed ---

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

Description

What is the purpose of this pull request?

This pull request:

  • {{TODO: add description describing what this pull request does}}

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

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 15, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 15, 2025

Coverage Report

Package Statements Branches Functions Lines
ndarray/unshift $\color{green}218/218$
$\color{green}+0.00%$
$\color{green}22/22$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}218/218$
$\color{green}+0.00%$

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

@headlessNode headlessNode added the Feature Issue or pull request for adding a new feature. label Dec 15, 2025
@headlessNode headlessNode requested a review from kgryte December 15, 2025 15:16
@kgryte
Copy link
Member

kgryte commented Dec 19, 2025

@headlessNode The changes made in #9054 will likely carry over to this PR.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Dec 19, 2025
headlessNode and others added 3 commits December 21, 2025 13:13
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@headlessNode
Copy link
Member Author

@kgryte in #9054 you changes the function description in the README.md and the package.json. But in the README.md the "Return..." and "Returns..." versions are a little different. Is that intentional or do we need to fix that?

@kgryte
Copy link
Member

kgryte commented Dec 21, 2025

Yeah, we should update the main README and package description to include "one-dimensional".

@kgryte
Copy link
Member

kgryte commented Dec 21, 2025

@headlessNode Is this ready for review or do you still need to make additional changes? I went ahead and updated the main README description in ndarray/push.

@headlessNode headlessNode added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Dec 22, 2025
@headlessNode
Copy link
Member Author

@kgryte yeah, ready for review.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Dec 23, 2025

# unshift

> Return a one-dimensional [ndarray][@stdlib/ndarray/ctor] formed by prepending the provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> Return a one-dimensional [ndarray][@stdlib/ndarray/ctor] formed by prepending the provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor].
> Return a one-dimensional [ndarray][@stdlib/ndarray/ctor] formed by prepending provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor].

This change applies throughout this PR.


#### unshift.assign( x, ...values, out )

Prepends the provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor] and assigns the result to a provided one-dimensional output [ndarray][@stdlib/ndarray/ctor].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Prepends the provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor] and assigns the result to a provided one-dimensional output [ndarray][@stdlib/ndarray/ctor].
Prepends provided scalar values to a one-dimensional input [ndarray][@stdlib/ndarray/ctor] and assigns the result to a provided one-dimensional output [ndarray][@stdlib/ndarray/ctor].

Copy link
Member

@kgryte kgryte Dec 23, 2025

Choose a reason for hiding this comment

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

This change applies throughout this PR.


'use strict';

var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
Copy link
Member

Choose a reason for hiding this comment

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

@headlessNode Use random/discrete-uniform directly.

discreteUniform( [ 6 ], 0, 10, opts );


function badValue( value ) {
return function badValue() {
unshift( zeros( [ 2 ]), 0.0, value );
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
unshift( zeros( [ 2 ]), 0.0, value );
unshift( zeros( [ 2 ] ), 0.0, value );

}
});

tape( 'the function prepends the provided provided scalar values to the input ndarray and assigns results to an output ndarray (row-major, contiguous)', function test( t ) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tape( 'the function prepends the provided provided scalar values to the input ndarray and assigns results to an output ndarray (row-major, contiguous)', function test( t ) {
tape( 'the function prepends provided provided scalar values to the input ndarray and assigns results to an output ndarray (row-major, contiguous)', function test( t ) {

Applies here and elsewhere.

## Examples

```javascript
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
Copy link
Member

Choose a reason for hiding this comment

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

Use random/discrete-uniform directly.

Copy link
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.

Left an initial round of comments.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Dec 23, 2025
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. Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add ndarray/unshift

3 participants