title: Find prime numbers using Scala. Help me to improve
body: <p>I wrote this code to find the prime numbers less than the given number i in scala.</p>
  
  <pre><code>def findPrime(i : Int) : List[Int] = i match {
      case 2 =&gt; List(2)
      case _ =&gt; {
      val primeList = findPrime(i-1)
      if(isPrime(i, primeList)) i :: primeList else primeList
      }
  }
  
  def isPrime(num : Int, prePrimes : List[Int]) : Boolean = prePrimes.forall(num % _ != 0)    
  </code></pre>
  
  <p>But, I got a feeling the findPrime function, especially this part:</p>
  
  <pre><code>case _ =&gt; {
      val primeList = findPrime(i-1)
      if(isPrime(i, primeList)) i :: primeList else primeList
  }
  </code></pre>
  
  <p>is not quite in the functional style.</p>
  
  <p>I am still learning functional programming. Can anyone please help me improve this code to make it more functional.</p>
  
  <p>Many thanks.</p>