title: Challenge in building a list in scala recursively
body: <p>How to write a function, which builds a list of the given length. Each element is determined by applying f to the index of the element:</p>
  
  <pre><code>def buildList[A](length: Int, f: Int =&gt; A): List[A]
  </code></pre>
  
  <p>test case would be something like this:</p>
  
  <pre><code>test("test") {
  def f(x: Int) = x
  assert(buildList(10, f) == List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) 
  </code></pre>
  
  <p>So an input example would be listBuild(10,f) = output List(0,....9)</p>
  
  <p>I'd know how to do this in OOL but functioning programming is a somewhat new concept to me. </p>
  
  <p>Any ideas on  how to accomplish this? At least, the pseudo code would help..</p>
  
  <p>PS: This is not HW. I have been trying to teach myself scala and this is a function I have been struggling with...</p>