title: Python lambda expression compose iterator script
body: <p>I'm writing a python script that should take a list of functions, written as lambda expressions, and return the compose of all the function, but, I have an arrow in the script, maybe because of the way I'm using lambda expression. It seems like even after I give the returned function a number value, I get back a function, and not a number. This is what I've wrote:</p>
  
  <pre><code>def compose1(lst):
      if lst == []:
          return lambda x: x
      else:
          temp = (lst[len(lst)-1])
          for i in range(len(lst)-2,-1,-1):
              temp = lambda x: lst[i](temp)
          return lambda x: temp
  </code></pre>
  
  <p>this is a tast for the function I've wrote, which says I have a mistake.</p>
  
  <pre><code>f = compose1([lambda x: x+1, lambda x: x*2, lambda x: x-1])
  for x in range(10):
      assert (f(x) == 1 + (x - 1) * 2)
  f = compose1([lambda x: x-1, lambda x: x*2, lambda x: x+1])
  for x in range(10):
      assert (f(x) == (x + 1) * 2) - 1
  </code></pre>
  
  <p>I would apreciate some halp on this problem..
  thanks :)</p>