From c4457039a09c4d7adf7e254fbe624936bf501db2 Mon Sep 17 00:00:00 2001
From: stdlib-bot <noreply@stdlib.io>
Date: Sat, 14 Dec 2024 09:18:58 +0000
Subject: [PATCH] Auto-generated commit

---
 CHANGELOG.md |  1 +
 README.md    | 39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b44a1d7..bebe306 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
 
 <details>
 
+-   [`855b8c2`](https://github.com/stdlib-js/stdlib/commit/855b8c255abba003e9505aa3a80105a2e2b6b3a7) - **docs:** add example _(by Athan Reines)_
 -   [`1cc3e09`](https://github.com/stdlib-js/stdlib/commit/1cc3e095080947f8fdd61ea2217f9b3031b9f93b) - **docs:** fix annotation _(by Athan Reines)_
 -   [`7efc6f3`](https://github.com/stdlib-js/stdlib/commit/7efc6f3c8f899974f7d11cb9e06f65f90d5caaa9) - **bench:** fix symbol name _(by Athan Reines)_
 -   [`354a147`](https://github.com/stdlib-js/stdlib/commit/354a1472bd69ab26c020aa7ba1df043c88e985b2) - **docs:** add note _(by Athan Reines)_
diff --git a/README.md b/README.md
index 914d1f3..68473f1 100644
--- a/README.md
+++ b/README.md
@@ -102,9 +102,9 @@ var arr = ndarray2array( y );
 The function accepts the following arguments:
 
 -   **x**: input [ndarray][@stdlib/ndarray/ctor].
--   **options**: function options.
+-   **options**: function options _(optional)_.
 -   **predicate**: predicate function.
--   **thisArg**: predicate function execution context.
+-   **thisArg**: predicate function execution context _(optional)_.
 
 The function accepts the following options:
 
@@ -146,6 +146,41 @@ var arr = ndarray2array( y );
 // returns [ 8.0, 9.0, 10.0 ]
 ```
 
+To set the `predicate` function execution context, provide a `thisArg`.
+
+<!-- eslint-disable no-invalid-this, max-len -->
+
+```javascript
+var Float64Array = require( '@stdlib/array-float64' );
+var ndarray = require( '@stdlib/ndarray-ctor' );
+var ndarray2array = require( '@stdlib/ndarray-to-array' );
+
+function predicate( z ) {
+    this.count += 1;
+    return z > 6.0;
+}
+
+var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
+var shape = [ 2, 3 ];
+var strides = [ 6, 1 ];
+var offset = 1;
+
+var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
+// returns <ndarray>
+
+var ctx = {
+    'count': 0
+};
+var y = filter( x, predicate, ctx );
+// returns <ndarray>
+
+var arr = ndarray2array( y );
+// returns [ 8.0, 9.0, 10.0 ]
+
+var count = ctx.count;
+// returns 6
+```
+
 The `predicate` function is provided the following arguments:
 
 -   **value**: current array element.