A recursive map

    :param fn: a function
    :param coll: a list
    :param isiterable: a predicate function determining whether a value is iterable.
    :returns: a list

    >>> rmap(lambda x: 2*x, [1, 2, [3, 4]])
    [2, 4, [6, 8]]

def rmap(fn, coll, is_iterable=None):
    """A recursive map

    :param fn: a function
    :param coll: a list
    :param isiterable: a predicate function determining whether a value is iterable.
    :returns: a list

    >>> rmap(lambda x: 2*x, [1, 2, [3, 4]])
    [2, 4, [6, 8]]

    """
    result = []
    for x in coll:
        if is_iterable is None:
            is_iterable = isiterable

        if is_iterable(x):
            y = rmap(fn, x)
        else:
            y = fn(x)
        result.append(y)
    return result