aspis.common.apply_to
- aspis.common.apply_to(val, func)[source]
Takes a value and applies a function to it.
This function is also known as thrush combinator.
- Parameters:
val (T) – The value to apply the function to.
func (Callable[[T], R]) – The function to apply to the value.
- Returns:
The result of applying the function to the value.
- Return type:
R
Example
>>> apply_to(5, lambda x: x * 2) 10 >>> apply_to([1, 2, 3], len) 3