You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add `no_wrap` option to `head()`, `head_option()`, `first()`, `last()` and `last_option()`, as well as to `seq()`, `pseq()` and `Sequence` constructor
4
5
5
6
## Release 1.3.0
6
7
* added precompute attribute to reverse transformation (#137)
@@ -72,7 +73,7 @@ Reaching `1.0` primarily means that API stability has been reached so I don't ex
Below is the complete list of functions which can be called on a stream object from `seq`. For
320
320
complete documentation reference
321
-
[transformation and actions API](http://docs.pyfunctional.org/en/latest/functional.html#module-functional.pipeline).
321
+
[transformation and actions API](http://docs.pyfunctional.pedro.ai/en/latest/functional.html#module-functional.pipeline).
322
322
323
323
Function | Description | Type
324
324
------- | ----------- | ----
@@ -362,10 +362,10 @@ Function | Description | Type
362
362
`sorted(key=None, reverse=False)/order_by(func)` | Returns elements sorted according to python `sorted` | transformation
363
363
`reverse()` | Returns the reversed sequence | transformation
364
364
`slice(start, until)` | Sequence starting at `start` and including elements up to `until` | transformation
365
-
`head()` / `first()` | Returns first element in sequence | action
366
-
`head_option()` | Returns first element in sequence or `None` if its empty | action
367
-
`last()` | Returns last element in sequence | action
368
-
`last_option()` | Returns last element in sequence or `None` if its empty | action
365
+
`head(no_wrap=None)` / `first(no_wrap=None)` | Returns first element in sequence (if `no_wrap=True`, the result will never be wrapped with `Sequence`) | action
366
+
`head_option(no_wrap=None)` | Returns first element in sequence or `None` if its empty (if `no_wrap=True`, the result will never be wrapped with `Sequence`) | action
367
+
`last(no_wrap=None)` | Returns last element in sequence (if `no_wrap=True`, the result will never be wrapped with `Sequence`) | action
368
+
`last_option(no_wrap=None)` | Returns last element in sequence or `None` if its empty (if `no_wrap=True`, the result will never be wrapped with `Sequence`) | action
369
369
`len()` / `size()` | Returns length of sequence | action
370
370
`count(func)` | Returns count of elements in sequence where `func(element)` is True | action
371
371
`empty()` | Returns `True` if the sequence has zero length | action
@@ -397,6 +397,7 @@ Function | Description | Type
397
397
`to_pandas(columns=None)` | Converts the sequence to a pandas DataFrame | action
398
398
`cache()` | Forces evaluation of sequence immediately and caches the result | action
399
399
`for_each(func)` | Executes `func` on each element of the sequence | action
400
+
`peek(func)` | Executes `func` on each element of the sequence but returns the element | transformation
400
401
401
402
### Lazy Execution
402
403
Whenever possible, `PyFunctional` will compute lazily. This is accomplished by tracking the list
@@ -411,11 +412,17 @@ undesirable to keep recomputing the same value. Below are some examples of inspe
411
412
412
413
```python
413
414
deftimes_2(x):
414
-
print(x)
415
415
return2* x
416
-
elements = seq(1, 1, 2, 3, 4).map(times_2).distinct()
0 commit comments