def dictf(d):
  """
  Returns a function with the behavior defined by a dictionary.
  
  Suppose a dictionary `d`, and `f` = :code:`dictf(d)`. 
  
  Then, for a given `x`, the `f(x) = d[x]`.
  
  Examples
  --------
  
  Consider a simple dictionary. 
  
  >>> d = {0: False, 1: True}  
  
  We can use it directly to get the values like:
  
  >>> dictf(d)(0)
  False
  
  Furthermore, we can easily combine it with other functions, e.g., 
  with the :func:`map`.
  
  >>> map(dictf(d), [0, 1, 0])  
  [False, True, False]
  
  """
  return lambda x: d[x]