functionalthreading 1.0.0__tar.gz → 1.0.2__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.2
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,11 +270,11 @@ chain(
270
270
  ```
271
271
 
272
272
 
273
- ### tmap(argument, func)
274
- ### tmap(func)
275
- Map a function concurrently across each element of an list or tuple.
273
+ ### tmap(argument, function)
274
+ ### tmap(function)
275
+ Map a function concurrently across each element of a list or tuple.
276
276
 
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.
277
+ A mapper is a function that specifies a single element of a list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
278
278
 
279
279
  ```python
280
280
  squared = tmap([1, 2, 3], lambda n: n ** 2)
@@ -288,9 +288,9 @@ squared = my_mapping_func([1, 2, 3])
288
288
  ```
289
289
 
290
290
 
291
- ### tforeach(argument, func)
292
- ### tforeach(func)
293
- Execute a callback concurrently for each element of an list or tuple.
291
+ ### tforeach(argument, function)
292
+ ### tforeach(function)
293
+ Execute a callback concurrently for each element of a 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.
296
296
 
@@ -306,11 +306,11 @@ my_foreach_func([1, 2, 3])
306
306
  ```
307
307
 
308
308
 
309
- ### tfilter(argument, func)
310
- ### tfilter(func)
311
- Concurrently filter an list or tuple.
309
+ ### tfilter(argument, function)
310
+ ### tfilter(function)
311
+ Concurrently filter a list or tuple.
312
312
 
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.
313
+ A predicate is a function that specifies an element of a 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.
314
314
 
315
315
  ```python
316
316
  def is_odd(n):
@@ -330,9 +330,37 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
330
330
  ```
331
331
 
332
332
 
333
- ### tflatmap(argument, func)
334
- ### tflatmap(func)
335
- Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
333
+ ### reduce(argument, function, /[, initial])
334
+ ### reduce(function, /[, initial])
335
+ Reduce a list or tuple to a single value (accumulator).
336
+
337
+ A reducer is a function that specifies an accumulator and a given element of a 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)
363
+ Apply a flatmapper concurrently to each element of a 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.
338
366
 
@@ -255,11 +255,11 @@ chain(
255
255
  ```
256
256
 
257
257
 
258
- ### tmap(argument, func)
259
- ### tmap(func)
260
- Map a function concurrently across each element of an list or tuple.
258
+ ### tmap(argument, function)
259
+ ### tmap(function)
260
+ Map a function concurrently across each element of a list or tuple.
261
261
 
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.
262
+ A mapper is a function that specifies a single element of a list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
263
263
 
264
264
  ```python
265
265
  squared = tmap([1, 2, 3], lambda n: n ** 2)
@@ -273,9 +273,9 @@ squared = my_mapping_func([1, 2, 3])
273
273
  ```
274
274
 
275
275
 
276
- ### tforeach(argument, func)
277
- ### tforeach(func)
278
- Execute a callback concurrently for each element of an list or tuple.
276
+ ### tforeach(argument, function)
277
+ ### tforeach(function)
278
+ Execute a callback concurrently for each element of a 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.
281
281
 
@@ -291,11 +291,11 @@ my_foreach_func([1, 2, 3])
291
291
  ```
292
292
 
293
293
 
294
- ### tfilter(argument, func)
295
- ### tfilter(func)
296
- Concurrently filter an list or tuple.
294
+ ### tfilter(argument, function)
295
+ ### tfilter(function)
296
+ Concurrently filter a list or tuple.
297
297
 
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.
298
+ A predicate is a function that specifies an element of a 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.
299
299
 
300
300
  ```python
301
301
  def is_odd(n):
@@ -315,9 +315,37 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
315
315
  ```
316
316
 
317
317
 
318
- ### tflatmap(argument, func)
319
- ### tflatmap(func)
320
- Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
318
+ ### reduce(argument, function, /[, initial])
319
+ ### reduce(function, /[, initial])
320
+ Reduce a list or tuple to a single value (accumulator).
321
+
322
+ A reducer is a function that specifies an accumulator and a given element of a 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)
348
+ Apply a flatmapper concurrently to each element of a 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.
323
351
 
@@ -112,9 +112,9 @@ def _tmap(argument, func):
112
112
  return result
113
113
 
114
114
  def tmap(*args):
115
- """Map a function concurrently across each element of an list or tuple.
115
+ """Map a function concurrently across each element of a list or tuple.
116
116
 
117
- 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.
117
+ A mapper is a function that specifies a single element of a list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
118
118
 
119
119
  ```python
120
120
  squared = tmap([1, 2, 3], lambda n: n ** 2)
@@ -147,7 +147,7 @@ def _tforeach(argument, func):
147
147
  return None
148
148
 
149
149
  def tforeach(*args):
150
- """Execute a callback concurrently for each element of an list or tuple.
150
+ """Execute a callback concurrently for each element of a list or tuple.
151
151
 
152
152
  A callback is a function that does not necessarily specify a value or return. Each callback invocation happens in a separate thread.
153
153
 
@@ -190,9 +190,9 @@ def _tfilter(argument, func):
190
190
  return result
191
191
 
192
192
  def tfilter(*args):
193
- """Concurrently filter an list or tuple.
193
+ """Concurrently filter a list or tuple.
194
194
 
195
- 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.
195
+ A predicate is a function that specifies an element of a 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.
196
196
 
197
197
  ```python
198
198
  def is_odd(n):
@@ -217,9 +217,9 @@ def tfilter(*args):
217
217
  return _tfilter(*args)
218
218
 
219
219
  def reduce(*args):
220
- """Reduce an list or tuple to a single value (accumulator).
220
+ """Reduce a list or tuple to a single value (accumulator).
221
221
 
222
- 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.
222
+ A reducer is a function that specifies an accumulator and a given element of a list or tuple, and returns an accumulator. Each reducer invocation happens sequentially.
223
223
 
224
224
  ```python
225
225
  # add is a reducer
@@ -273,7 +273,7 @@ def _tflatmap(argument, func):
273
273
  return result
274
274
 
275
275
  def tflatmap(*args):
276
- """Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
276
+ """Apply a flatmapper concurrently to each element of a list or tuple, concatenating the results.
277
277
 
278
278
  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.
279
279
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: functionalthreading
3
- Version: 1.0.0
3
+ Version: 1.0.2
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,11 +270,11 @@ chain(
270
270
  ```
271
271
 
272
272
 
273
- ### tmap(argument, func)
274
- ### tmap(func)
275
- Map a function concurrently across each element of an list or tuple.
273
+ ### tmap(argument, function)
274
+ ### tmap(function)
275
+ Map a function concurrently across each element of a list or tuple.
276
276
 
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.
277
+ A mapper is a function that specifies a single element of a list or tuple and returns a corresponding element of the resulting list or tuple. Each mapper invocation happens in a separate thread.
278
278
 
279
279
  ```python
280
280
  squared = tmap([1, 2, 3], lambda n: n ** 2)
@@ -288,9 +288,9 @@ squared = my_mapping_func([1, 2, 3])
288
288
  ```
289
289
 
290
290
 
291
- ### tforeach(argument, func)
292
- ### tforeach(func)
293
- Execute a callback concurrently for each element of an list or tuple.
291
+ ### tforeach(argument, function)
292
+ ### tforeach(function)
293
+ Execute a callback concurrently for each element of a 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.
296
296
 
@@ -306,11 +306,11 @@ my_foreach_func([1, 2, 3])
306
306
  ```
307
307
 
308
308
 
309
- ### tfilter(argument, func)
310
- ### tfilter(func)
311
- Concurrently filter an list or tuple.
309
+ ### tfilter(argument, function)
310
+ ### tfilter(function)
311
+ Concurrently filter a list or tuple.
312
312
 
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.
313
+ A predicate is a function that specifies an element of a 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.
314
314
 
315
315
  ```python
316
316
  def is_odd(n):
@@ -330,9 +330,37 @@ odd_numbers = filter_odds([1, 2, 3, 4, 5])
330
330
  ```
331
331
 
332
332
 
333
- ### tflatmap(argument, func)
334
- ### tflatmap(func)
335
- Apply a flatmapper concurrently to each element of an list or tuple, concatenating the results.
333
+ ### reduce(argument, function, /[, initial])
334
+ ### reduce(function, /[, initial])
335
+ Reduce a list or tuple to a single value (accumulator).
336
+
337
+ A reducer is a function that specifies an accumulator and a given element of a 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)
363
+ Apply a flatmapper concurrently to each element of a 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.
338
366
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "functionalthreading"
3
- version = "1.0.0"
3
+ version = "1.0.2"
4
4
  authors = [
5
5
  { name="Richard Tong", email="richytong@gmail.com" },
6
6
  ]