def replacef(s, r=''):
  """
  Returns a function that replaces substrings with a replacement.
  
  Examples
  --------
  >>> f = replacef('inside', 'outside')
  >>> f('Thankfully, I have spent the day inside.')
  'Thankfully, I have spent the day outside.'
  """
  return lambda e: e.replace(s, r)