def mapf(f):
  """
  Turns a function `f` into a function over 
  lists, applying `f` to each element of the list. 
  
  Arguments
  ---------
  f : function
    The function. 
    
  Returns
  -------
  g : function
    Function that applies `f` over each element of a list. 
  
  Examples
  --------
  
  Define a function `f`:
  
  >>> f = lambda x: x + 1
  
  We apply it over a list in the following way:
  
  >>> mapf(f)([1, 2, 3])
  [2, 3, 4]
  
  """
  return lambda x: map(f, x)