Skip to content

Conversation

thedeeppp
Copy link
Contributor

Resolves #5688 .

Description

What is the purpose of this pull request?

This pull request:

  • added accessors.js and changed other files to implement the logic of accessors
  • added test to check Accessor implementation
  • checked that every test and commands works correctly or throws issue

{10D8E3FA-F35D-46DE-AF10-D55278D9EA6B}
It passes all tests.

Related Issues

Does this pull request have any related issues?

This pull request:

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.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 11, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Mar 11, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/variancech $\color{green}403/403$
$\color{green}+100.00\%$
$\color{green}39/39$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}403/403$
$\color{green}+100.00\%$

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

@thedeeppp
Copy link
Contributor Author

@kgryte please let me know if further changes needed

var i;

// Check for accessor array:
if ( x.get ) {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't a sufficient check. Please follow what we do in other implementations supporting the accessor protocol.

ix = offset;

// Use an estimate for the mean:
mu = x.get( ix );
Copy link
Member

Choose a reason for hiding this comment

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

This is not what we want. Follow the conventions in other packages already having accessor protocol support.


// MODULES //

var ndarray = require( './ndarray.js' );
Copy link
Member

@kgryte kgryte Mar 12, 2025

Choose a reason for hiding this comment

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

var v;

x = {
'get': function get( i ) {
Copy link
Member

Choose a reason for hiding this comment

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

This is not what we want. Use toAccessorArray as in other implementations supporting accessor arrays. In short, emulate as closely as possible what we do in other packages.

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. In short, you need to more closely emulate what we do in https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/max

@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 Mar 12, 2025
@thedeeppp thedeeppp closed this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: refactor and add protocol support to stats/base/variancech

3 participants