Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Oct 30, 2024
1 parent 1ebb1d3 commit cf225b7
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 10 deletions.
34 changes: 30 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<section class="release" id="unreleased">

## Unreleased (2024-10-29)
## Unreleased (2024-10-30)

<section class="packages">

Expand Down Expand Up @@ -550,6 +550,30 @@ This release closes the following issue:

<!-- /.package -->

<section class="package" id="math-iter-ops-unreleased">

#### [@stdlib/math/iter/ops](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/iter/ops)

<details>

<section class="issues">

##### Closed Issues

This release closes the following issue:

[#1575](https://github.com/stdlib-js/stdlib/issues/1575)

</section>

<!-- /.issues -->

</details>

</section>

<!-- /.package -->

</section>

<!-- /.packages -->
Expand All @@ -558,9 +582,9 @@ This release closes the following issue:

### Closed Issues

This release closes the following issue:
A total of 2 issues were closed in this release:

[#225](https://github.com/stdlib-js/stdlib/issues/225)
[#225](https://github.com/stdlib-js/stdlib/issues/225), [#1575](https://github.com/stdlib-js/stdlib/issues/1575)

</section>

Expand All @@ -570,13 +594,14 @@ This release closes the following issue:

### Contributors

A total of 7 people contributed to this release. Thank you to the following contributors:
A total of 8 people contributed to this release. Thank you to the following contributors:

- Aayush Khanna
- AbhijitRaut04
- Aman Bhansali
- Athan Reines
- Ayaka
- Dominic Lim
- Gunj Joshi
- Philipp Burckhardt

Expand All @@ -590,6 +615,7 @@ A total of 7 people contributed to this release. Thank you to the following cont

<details>

- [`43ac1e7`](https://github.com/stdlib-js/stdlib/commit/43ac1e77bd764f110c19a3eb08421d0a4af9fc61) - **docs:** improve `math/iter/ops` examples [(#2008)](https://github.com/stdlib-js/stdlib/pull/2008) _(by Dominic Lim, Philipp Burckhardt)_
- [`ed4c8d6`](https://github.com/stdlib-js/stdlib/commit/ed4c8d65a020d119c4baa1eb6716751c75cf8a07) - **feat:** add support for secant functionality `math/base/special/sec` [(#3027)](https://github.com/stdlib-js/stdlib/pull/3027) _(by AbhijitRaut04, Athan Reines, Philipp Burckhardt)_
- [`b18921a`](https://github.com/stdlib-js/stdlib/commit/b18921a136da2755efccfd6ae23c8b3f5aaa8f4a) - **feat:** add `math/base/special/acosdf` [(#3015)](https://github.com/stdlib-js/stdlib/pull/3015) _(by Aayush Khanna, Athan Reines)_
- [`60522bf`](https://github.com/stdlib-js/stdlib/commit/60522bfc0b5574d348301e788400178156731024) - **docs:** fix operator [(#3039)](https://github.com/stdlib-js/stdlib/pull/3039) _(by Gunj Joshi)_
Expand Down
45 changes: 41 additions & 4 deletions iter/ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,52 @@ The namespace contains the following functions for creating iterator protocol-co

## Examples

<!-- TODO: better examples -->

<!-- eslint no-undef: "error" -->

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var array2iterator = require( '@stdlib/array/to-iterator' );
var ns = require( '@stdlib/math/iter/ops' );

console.log( objectKeys( ns ) );
// Demonstrate operations with two iterators:
var arr1 = [ 2.0, 3.0 ];
var arr2 = [ 1.0, 4.0 ];
var itAdd = ns.iterAdd( array2iterator( arr1 ), array2iterator( arr2 ) );
var itDiv = ns.iterDivide( array2iterator( arr1 ), array2iterator( arr2 ) );
var itMul = ns.iterMultiply( array2iterator( arr1 ), array2iterator( arr2 ) );
var itSub = ns.iterSubtract( array2iterator( arr1 ), array2iterator( arr2 ) );

// Addition: 2+1=3, 3+4=7
console.log( itAdd.next().value );
// => 3.0
console.log( itAdd.next().value );
// => 7.0

// Division: 2/1=2, 3/4=0.75
console.log( itDiv.next().value );
// => 2.0
console.log( itDiv.next().value );
// => 0.75

// Multiplication: 2*1=2, 3*4=12
console.log( itMul.next().value );
// => 2.0
console.log( itMul.next().value );
// => 12.0

// Subtraction: 2-1=1, 3-4=-1
console.log( itSub.next().value );
// => 1.0
console.log( itSub.next().value );
// => -1.0

// Demonstrate operation with iterator and constant
var it3 = array2iterator( [ 1.0, 2.0 ] );
var itWithConstant = ns.iterAdd( it3, 3.0 );

console.log( itWithConstant.next().value );
// => 4.0
console.log( itWithConstant.next().value );
// => 5.0
```

</section>
Expand Down
43 changes: 41 additions & 2 deletions iter/ops/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,46 @@

'use strict';

var objectKeys = require( '@stdlib/utils/keys' );
var array2iterator = require( '@stdlib/array/to-iterator' );
var ns = require( './../lib' );

console.log( objectKeys( ns ) );
// Demonstrate operations with two iterators:
var arr1 = [ 2.0, 3.0 ];
var arr2 = [ 1.0, 4.0 ];
var itAdd = ns.iterAdd( array2iterator( arr1 ), array2iterator( arr2 ) );
var itDiv = ns.iterDivide( array2iterator( arr1 ), array2iterator( arr2 ) );
var itMul = ns.iterMultiply( array2iterator( arr1 ), array2iterator( arr2 ) );
var itSub = ns.iterSubtract( array2iterator( arr1 ), array2iterator( arr2 ) );

// Addition: 2+1=3, 3+4=7
console.log( itAdd.next().value );
// => 3.0
console.log( itAdd.next().value );
// => 7.0

// Division: 2/1=2, 3/4=0.75
console.log( itDiv.next().value );
// => 2.0
console.log( itDiv.next().value );
// => 0.75

// Multiplication: 2*1=2, 3*4=12
console.log( itMul.next().value );
// => 2.0
console.log( itMul.next().value );
// => 12.0

// Subtraction: 2-1=1, 3-4=-1
console.log( itSub.next().value );
// => 1.0
console.log( itSub.next().value );
// => -1.0

// Demonstrate operation with iterator and constant
var it3 = array2iterator( [ 1.0, 2.0 ] );
var itWithConstant = ns.iterAdd( it3, 3.0 );

console.log( itWithConstant.next().value );
// => 4.0
console.log( itWithConstant.next().value );
// => 5.0

0 comments on commit cf225b7

Please sign in to comment.