from typing import Sequence
from typing import Callable


def argmax_f(s: Sequence, f: Callable) -> int:
    """
    Take the argmax (i.e. the index) based on the maximum of a particular
    function.

    Parameters
    ----------
    s : Sequence
        The sequence to find the argmax of.
    f : Callable
        The function to apply to the elements

    Returns
    -------
    int
        The index produced by the argmax.

    """
    return max(enumerate([f(d) for d in s]),
               key=lambda x: x[1])[0]