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 a1eba93 commit 440b196
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

37 changes: 35 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,42 @@
<section class="release" id="unreleased">

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

No changes reported for this release.
<section class="packages">

### Packages

</section>

<!-- /.packages -->

<section class="contributors">

### Contributors

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

- Philipp Burckhardt
- Shivam

</section>

<!-- /.contributors -->

<section class="commits">

### Commits

<details>

- [`e469715`](https://github.com/stdlib-js/stdlib/commit/e46971500650a5dcf1c9734341de8aeaf4360468) - **docs:** improve README examples of `math/iter/sequences` [(#1779)](https://github.com/stdlib-js/stdlib/pull/1779) _(by Shivam, Philipp Burckhardt)_

</details>

</section>

<!-- /.commits -->

</section>

Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
Frank Kovacs <fran70kk@gmail.com>
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
Gunj Joshi <gunjjoshi8372@gmail.com>
Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com>
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
Harshita Kalani <harshitakalani02@gmail.com>
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
Expand All @@ -44,6 +45,7 @@ Justin Dennison <justin1dennison@gmail.com>
Kaif Mohd <mdkaifprofession@gmail.com>
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
Khaldon <kahmd1444@gmail.com>
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
Lovelin <100030865+lovelindhoni@users.noreply.github.com>
Manik Sharma <maniksharma.rke@gmail.com>
Expand All @@ -67,6 +69,7 @@ Praneki <97080887+PraneGIT@users.noreply.github.com>
Pratik <97464067+Pratik772846@users.noreply.github.com>
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
RISHAV <115060907+rishav2404@users.noreply.github.com>
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
Ricky Reusser <rsreusser@gmail.com>
Expand Down Expand Up @@ -94,6 +97,7 @@ Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
Utkarsh <http://utkarsh11105@gmail.com>
Utkarsh Raj <rajutkarsh2505@gmail.com>
UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
Varad Gupta <varadgupta21@gmail.com>
Xiaochuan Ye <tap91624@gmail.com>
Expand Down
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,48 @@ 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 ns = require( '@stdlib/math-iter-sequences' );

console.log( objectKeys( ns ) );
// Create iterators for generating square and cube numbers:
var squares = ns.iterSquaresSeq();
var cubes = ns.iterCubesSeq();

// Iterate over both sequences and log the first five pairs:
var square;
var cube;
var i;
for ( i = 0; i < 5; i++ ) {
square = squares.next().value;
cube = cubes.next().value;
console.log( 'Square: %d, Cube: %d', square, cube );
}

// Calculate the sum of the first ten Fibonacci numbers:
var fibonacci = ns.iterFibonacciSeq({
'iter': 10
});
var sum = 0;
var v = fibonacci.next();
while ( v.done === false ) {
sum += v.value;
v = fibonacci.next();
}
console.log( 'Sum of first ten Fibonacci numbers: %d', sum );

// Generate prime numbers:
var primes = ns.iterPrimesSeq({
'iter': 10
});

console.log( 'First ten prime numbers:' );
v = primes.next();
while ( v.done === false ) {
console.log( v.value );
v = primes.next();
}
```

</section>
Expand Down
41 changes: 38 additions & 3 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,42 @@

'use strict';

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

console.log( objectKeys( ns ) );
// Create iterators for generating square and cube numbers:
var squares = ns.iterSquaresSeq();
var cubes = ns.iterCubesSeq();

// Iterate over both sequences and log the first five pairs:
var square;
var cube;
var i;
for ( i = 0; i < 5; i++ ) {
square = squares.next().value;
cube = cubes.next().value;
console.log( 'Square: %d, Cube: %d', square, cube );
}

// Calculate the sum of the first 10 Fibonacci numbers:
var fibonacci = ns.iterFibonacciSeq({
'iter': 10
});
var sum = 0;
var v = fibonacci.next();
while ( v.done === false ) {
sum += v.value;
v = fibonacci.next();
}
console.log( 'Sum of first 10 Fibonacci numbers: %d', sum );

// Generate prime numbers:
var primes = ns.iterPrimesSeq({
'iter': 10
});

console.log( 'First ten prime numbers:' );
v = primes.next();
while ( v.done === false ) {
console.log( v.value );
v = primes.next();
}

0 comments on commit 440b196

Please sign in to comment.