functionalthreading 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: functionalthreading
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Concurrent functional programming with thread-based parallelism
5
5
  Author-email: Richard Tong <richytong@gmail.com>
6
6
  License-Expression: Unlicense
@@ -270,8 +270,8 @@ chain(
270
270
  ```
271
271
 
272
272
 
273
- ### tmap(argument, func)
274
- ### tmap(func)
273
+ ### tmap(argument, function)
274
+ ### tmap(function)
275
275
  Map a function concurrently across each element of an list or tuple.
276
276
 
277
277
  A mapper is a function that specifies a single element of an list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
@@ -288,8 +288,8 @@ squared = my_mapping_func([1, 2, 3])
288
288
  ```
289
289
 
290
290
 
291
- ### tforeach(argument, func)
292
- ### tforeach(func)
291
+ ### tforeach(argument, function)
292
+ ### tforeach(function)
293
293
  Execute a callback concurrently for each element of an list or tuple.
294
294
 
295
295
  A callback is a function that does not necessarily specify a value or return. Each callback invocation happens in a separate thread.
@@ -306,8 +306,8 @@ my_foreach_func([1, 2, 3])
306
306
  ```
307
307
 
308
308
 
309
- ### tfilter(argument, func)
310
- ### tfilter(func)
309
+ ### tfilter(argument, function)
310
+ ### tfilter(function)
311
311
  Concurrently filter an list or tuple.
312
312
 
313
313
  A predicate is a function that specifies an element of an list or tuple and returns a boolean value. Elements corresponding to predicate invocations that return `False` are filtered out of the resulting list or tuple, while elements corresponding to predicate invocationsn that return `True` are retained. Each predicate invocation happens in a separate thread.
@@ -330,8 +330,36 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
330
330
  ```
331
331
 
332
332
 
333
- ### tflatmap(argument, func)
334
- ### tflatmap(func)
333
+ ### reduce(argument, function, /[, initial])
334
+ ### reduce(function, /[, initial])
335
+ Reduce an list or tuple to a single value (accumulator).
336
+
337
+ A reducer is a function that specifies an accumulator and a given element of an list or tuple, and returns an accumulator. Each reducer invocation happens sequentially.
338
+
339
+ ```python
340
+ # add is a reducer
341
+ def add(a, b):
342
+ return a + b
343
+
344
+ sum = reduce([1, 2, 3, 4, 5], add)
345
+ ```
346
+
347
+ If an initial value is provided, it is treated as the starting value for the accumulator.
348
+
349
+ ```python
350
+ sum = reduce([1, 2, 3, 4, 5], add, 10)
351
+ ```
352
+
353
+ If the list or tuple argument is omitted, returns a function of the reducer and initial value that expects the argument.
354
+
355
+ ```python
356
+ reducing_func = reduce(add, 10)
357
+ sum = reducing_func([1, 2, 3, 4, 5])
358
+ ```
359
+
360
+
361
+ ### tflatmap(argument, function)
362
+ ### tflatmap(function)
335
363
  Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
336
364
 
337
365
  A flatmapper is a function that specifies an element of the list or tuple, and returns a list, tuple, or single element. A returned list or tuple is concatenated onto the resulting list or tuple, while a returned single element is appended. Each flatmapper invocation happens in a separate thread.
@@ -255,8 +255,8 @@ chain(
255
255
  ```
256
256
 
257
257
 
258
- ### tmap(argument, func)
259
- ### tmap(func)
258
+ ### tmap(argument, function)
259
+ ### tmap(function)
260
260
  Map a function concurrently across each element of an list or tuple.
261
261
 
262
262
  A mapper is a function that specifies a single element of an list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
@@ -273,8 +273,8 @@ squared = my_mapping_func([1, 2, 3])
273
273
  ```
274
274
 
275
275
 
276
- ### tforeach(argument, func)
277
- ### tforeach(func)
276
+ ### tforeach(argument, function)
277
+ ### tforeach(function)
278
278
  Execute a callback concurrently for each element of an list or tuple.
279
279
 
280
280
  A callback is a function that does not necessarily specify a value or return. Each callback invocation happens in a separate thread.
@@ -291,8 +291,8 @@ my_foreach_func([1, 2, 3])
291
291
  ```
292
292
 
293
293
 
294
- ### tfilter(argument, func)
295
- ### tfilter(func)
294
+ ### tfilter(argument, function)
295
+ ### tfilter(function)
296
296
  Concurrently filter an list or tuple.
297
297
 
298
298
  A predicate is a function that specifies an element of an list or tuple and returns a boolean value. Elements corresponding to predicate invocations that return `False` are filtered out of the resulting list or tuple, while elements corresponding to predicate invocationsn that return `True` are retained. Each predicate invocation happens in a separate thread.
@@ -315,8 +315,36 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
315
315
  ```
316
316
 
317
317
 
318
- ### tflatmap(argument, func)
319
- ### tflatmap(func)
318
+ ### reduce(argument, function, /[, initial])
319
+ ### reduce(function, /[, initial])
320
+ Reduce an list or tuple to a single value (accumulator).
321
+
322
+ A reducer is a function that specifies an accumulator and a given element of an list or tuple, and returns an accumulator. Each reducer invocation happens sequentially.
323
+
324
+ ```python
325
+ # add is a reducer
326
+ def add(a, b):
327
+ return a + b
328
+
329
+ sum = reduce([1, 2, 3, 4, 5], add)
330
+ ```
331
+
332
+ If an initial value is provided, it is treated as the starting value for the accumulator.
333
+
334
+ ```python
335
+ sum = reduce([1, 2, 3, 4, 5], add, 10)
336
+ ```
337
+
338
+ If the list or tuple argument is omitted, returns a function of the reducer and initial value that expects the argument.
339
+
340
+ ```python
341
+ reducing_func = reduce(add, 10)
342
+ sum = reducing_func([1, 2, 3, 4, 5])
343
+ ```
344
+
345
+
346
+ ### tflatmap(argument, function)
347
+ ### tflatmap(function)
320
348
  Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
321
349
 
322
350
  A flatmapper is a function that specifies an element of the list or tuple, and returns a list, tuple, or single element. A returned list or tuple is concatenated onto the resulting list or tuple, while a returned single element is appended. Each flatmapper invocation happens in a separate thread.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: functionalthreading
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Concurrent functional programming with thread-based parallelism
5
5
  Author-email: Richard Tong <richytong@gmail.com>
6
6
  License-Expression: Unlicense
@@ -270,8 +270,8 @@ chain(
270
270
  ```
271
271
 
272
272
 
273
- ### tmap(argument, func)
274
- ### tmap(func)
273
+ ### tmap(argument, function)
274
+ ### tmap(function)
275
275
  Map a function concurrently across each element of an list or tuple.
276
276
 
277
277
  A mapper is a function that specifies a single element of an list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
@@ -288,8 +288,8 @@ squared = my_mapping_func([1, 2, 3])
288
288
  ```
289
289
 
290
290
 
291
- ### tforeach(argument, func)
292
- ### tforeach(func)
291
+ ### tforeach(argument, function)
292
+ ### tforeach(function)
293
293
  Execute a callback concurrently for each element of an list or tuple.
294
294
 
295
295
  A callback is a function that does not necessarily specify a value or return. Each callback invocation happens in a separate thread.
@@ -306,8 +306,8 @@ my_foreach_func([1, 2, 3])
306
306
  ```
307
307
 
308
308
 
309
- ### tfilter(argument, func)
310
- ### tfilter(func)
309
+ ### tfilter(argument, function)
310
+ ### tfilter(function)
311
311
  Concurrently filter an list or tuple.
312
312
 
313
313
  A predicate is a function that specifies an element of an list or tuple and returns a boolean value. Elements corresponding to predicate invocations that return `False` are filtered out of the resulting list or tuple, while elements corresponding to predicate invocationsn that return `True` are retained. Each predicate invocation happens in a separate thread.
@@ -330,8 +330,36 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
330
330
  ```
331
331
 
332
332
 
333
- ### tflatmap(argument, func)
334
- ### tflatmap(func)
333
+ ### reduce(argument, function, /[, initial])
334
+ ### reduce(function, /[, initial])
335
+ Reduce an list or tuple to a single value (accumulator).
336
+
337
+ A reducer is a function that specifies an accumulator and a given element of an list or tuple, and returns an accumulator. Each reducer invocation happens sequentially.
338
+
339
+ ```python
340
+ # add is a reducer
341
+ def add(a, b):
342
+ return a + b
343
+
344
+ sum = reduce([1, 2, 3, 4, 5], add)
345
+ ```
346
+
347
+ If an initial value is provided, it is treated as the starting value for the accumulator.
348
+
349
+ ```python
350
+ sum = reduce([1, 2, 3, 4, 5], add, 10)
351
+ ```
352
+
353
+ If the list or tuple argument is omitted, returns a function of the reducer and initial value that expects the argument.
354
+
355
+ ```python
356
+ reducing_func = reduce(add, 10)
357
+ sum = reducing_func([1, 2, 3, 4, 5])
358
+ ```
359
+
360
+
361
+ ### tflatmap(argument, function)
362
+ ### tflatmap(function)
335
363
  Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
336
364
 
337
365
  A flatmapper is a function that specifies an element of the list or tuple, and returns a list, tuple, or single element. A returned list or tuple is concatenated onto the resulting list or tuple, while a returned single element is appended. Each flatmapper invocation happens in a separate thread.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "functionalthreading"
3
- version = "1.0.0"
3
+ version = "1.0.1"
4
4
  authors = [
5
5
  { name="Richard Tong", email="richytong@gmail.com" },
6
6
  ]