diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6ffb8e2..1cf70f7db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-10-29) +## Unreleased (2024-10-30)
@@ -550,6 +550,30 @@ This release closes the following issue: +
+ +#### [@stdlib/math/iter/ops](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/iter/ops) + +
+ +
+ +##### Closed Issues + +This release closes the following issue: + +[#1575](https://github.com/stdlib-js/stdlib/issues/1575) + +
+ + + +
+ +
+ + +
@@ -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)
@@ -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 @@ -590,6 +615,7 @@ A total of 7 people contributed to this release. Thank you to the following cont
+- [`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)_ diff --git a/iter/ops/README.md b/iter/ops/README.md index 84cec115f..b286292f1 100644 --- a/iter/ops/README.md +++ b/iter/ops/README.md @@ -63,15 +63,52 @@ The namespace contains the following functions for creating iterator protocol-co ## Examples - - ```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 ``` diff --git a/iter/ops/examples/index.js b/iter/ops/examples/index.js index b34f8f452..35cfd0046 100644 --- a/iter/ops/examples/index.js +++ b/iter/ops/examples/index.js @@ -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