title: Class with method that applies any function to the arguments?
body: <p>I need a class with a mmethod that takes a function as argument and applies the function to each element of a list</p>
  
  <pre><code>class matrix:
      def __init__(self,xs):
          self.xs=xs  #xs is a list
  
      def map(self,function): ??? I don't know how to implent this one
  </code></pre>
  
  <p>The result should be something like</p>
  
  <pre><code>   v = matrix([1, 2, 3])
     r = v.map(sqrt)
     print(r)
     matrix [1.0, 1.41, 1.73]
  </code></pre>