def groupMap(key_func, value_func, iterable):
    """
        groupMap(key_func: function, value_func: function, iter: iterable)
            group elements with key_func, transform values with value_func

        args:
            key_func = L x: x%2,  value_func = L x: -x,  iter = [1,2,3]
        return:
            {0:[-2], 1:[-1,-3]}
    """
    res = {}
    for x in iterable:
        k = key_func(x)
        if k not in res: res[k] = []
        res[k].append(value_func(x))
    return res