Skip to content

Application

partial = standard_partial module-attribute

An alias of the standard partial type that implements partial application.

apply(function: Callable[P, R], *args: P.args, **kwargs: P.kwargs) -> R

Applies the function to given positional and keyword arguments.

apply(function, *args, **kwargs)

Is identical to:

function(*args, **kwargs)

Parameters:

Name Type Description Default
function Callable[P, R]

The function to apply arguments to.

required
*args args

Positional arguments to apply.

()
**kwargs kwargs

Keyword arguments to apply.

{}

Returns:

Type Description
R

The result of applying the function to given arguments.

Source code in src/funcs/application.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def apply(function: Callable[P, R], *args: P.args, **kwargs: P.kwargs) -> R:
    """Applies the `function` to given positional and keyword arguments.

    ```python
    apply(function, *args, **kwargs)
    ```

    Is identical to:

    ```python
    function(*args, **kwargs)
    ```

    Parameters:
        function: The function to apply arguments to.
        *args: Positional arguments to apply.
        **kwargs: Keyword arguments to apply.

    Returns:
        The result of applying the `function` to given arguments.
    """
    return function(*args, **kwargs)

juxt(*functions: Callable[P, Any]) -> Callable[P, DynamicTuple[Any]]

Returns the function that is the juxtaposition of given functions.

Parameters:

Name Type Description Default
*functions Callable[P, Any]

Functions to return the juxtaposition for.

()

Returns:

Type Description
Callable[P, DynamicTuple[Any]]

The juxtaposition of given functions.

Source code in src/funcs/application.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
def juxt(*functions: Callable[P, Any]) -> Callable[P, DynamicTuple[Any]]:
    """Returns the function that is the juxtaposition of given functions.

    Arguments:
        *functions: Functions to return the juxtaposition for.

    Returns:
        The juxtaposition of given functions.
    """

    def call(*args: P.args, **kwargs: P.kwargs) -> DynamicTuple[Any]:
        return tuple(function(*args, **kwargs) for function in functions)

    return call