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 Sep 19, 2023
1 parent ec81a83 commit 92d111a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ limitations under the License.
A **FancyArray** is an [`ndarray`][@stdlib/ndarray/ctor] which supports slicing via indexing expressions.

```javascript
var ndarray2array = require( '@stdlib/ndarray-to-array' );
var FancyArray = require( '@stdlib/ndarray-fancy' );

var buffer = [ 1, 2, 3, 4, 5, 6 ];
Expand All @@ -54,21 +55,21 @@ var x = new FancyArray( 'generic', buffer, [ 6 ], [ 1 ], 0, 'row-major' );
var y = x[ ':3' ];
// returns <FancyArray>

var arr = toArray( y );
var arr = ndarray2array( y );
// returns [ 1, 2, 3 ]

// Select every other element, starting with the second element:
y = x[ '1::2' ];
// returns <FancyArray>

arr = toArray( y );
arr = ndarray2array( y );
// returns [ 2, 4, 6 ]

// Reverse the array, starting with last element and skipping every other element:
y = x[ '::-2' ];
// returns <FancyArray>

arr = toArray( y );
arr = ndarray2array( y );
// returns [ 6, 4, 2 ]
```

Expand Down

0 comments on commit 92d111a

Please sign in to comment.