pfun.functions.identity(v)
The identity function. Just gives back its argument
Examples:
1 2 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v |
~A |
The value to get back |
required |
Returns:
Type | Description |
---|---|
~A |
|
pfun.functions.always(value)
Get a function that always returns value
Examples:
1 2 3 4 5 6 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
~A |
The value to return always |
required |
Returns:
Type | Description |
---|---|
Callable[..., ~A] |
function that always returns |
pfun.functions.compose(f, g, *functions)
Compose functions from left to right
Examples:
1 2 3 4 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable[[Any], Any] |
the outermost function in the composition |
required |
g |
Callable[[Any], Any] |
the function to be composed with f |
required |
functions |
Callable[[Any], Any] |
functions to be composed with |
() |
Returns:
Type | Description |
---|---|
Callable[[Any], Any] |
|
pfun.functions.pipeline(first, second, *rest)
Compose functions from right to left
Examples:
1 2 3 4 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
first |
Callable[[Any], Any] |
the innermost function in the composition |
required |
g |
|
the function to compose with f |
required |
functions |
|
functions to compose with |
required |
Returns:
Type | Description |
---|---|
|
|
pfun.functions.curry(f)
Get a version of f
that can be partially applied
Examples:
1 2 3 4 5 6 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable |
The function to curry |
required |
Returns:
Type | Description |
---|---|
Callable |
Curried version of |